var t,t2,op,objopacity,c=0,tempp;
var mygal_slidshow = false;
var mygal_slidshow_next, tss;
//isOpera=isOpera5=window.opera&&isDOM; //Opera 5+
	isOpera=isOpera5=window.opera; //Opera 5+
	isMSIE=document.all&&document.all.item&&!isOpera; //MSIE 4+
	isMozilla=navigator.appName=="Netscape"; //Mozilla

	var mousex = 0;
	var mousey = 0;

	if (isMSIE || isOpera){
		document.onmousemove = function(){
			mousex = event.clientX + document.body.scrollLeft+8;
			mousey = event.clientY + document.body.scrollTop+20;
			document.getElementById('mouse_loader_box').style.left = mousex+'px';
			document.getElementById('mouse_loader_box').style.top = mousey+'px';
			return true;
		}
	} else if (isMozilla){
		document.onmousemove=function(e){
			mousex = e.pageX+8;
			mousey = e.pageY+20;

			document.getElementById('mouse_loader_box').style.left = mousex+'px';
			document.getElementById('mouse_loader_box').style.top = mousey+'px';


			return true;
		}
	}

window.setTimeout('CheckAllNewUpdates()', 3000);


function GoogleMapInicialize(){      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map_canvas"));
        var center = new GLatLng(49.624946, 31.135254);

        map.setCenter(center, 6);
        map.setUIToDefault();

		var marker = new GMarker(center, {draggable: true});
        GEvent.addListener(marker, "dragstart", function() {
          map.closeInfoWindow();
        });

        GEvent.addListener(marker, "dragend", function() {
          marker.openInfoWindowHtml("It Works...");
        });

        map.addOverlay(marker);

      }
}

function ShowWindowMessage(title, message){
	Modalbox.show(message, {title: title, width: 280, height: 200});
}

function ShowMyProfileWindow(obj){
	Modalbox.show('/myprofile.html', {title: obj.title, width: 450, height: 250});
}

function ShowChatWindow(obj){
	Modalbox.show('/chatwindow.html', {title: obj.title, width: 400, height: 520, beforeHide: function(){CloseOlineChatUsr()}, afterLoad: function(){document.getElementById('chatnewmessage').focus()}});

}

function ShowProfileWindow(obj){
	Modalbox.show(obj.href, {title: obj.title, width: 550, height: 650});
}

function ShowFriendsWindow(obj, tab){
	obj.href = '/myfriendswind.html';
	if (tab > 0)
		obj.href = '/myfriendswind/'+tab+'.html';

	Modalbox.show(obj.href, {title: obj.title, width: 780, height: 550});
}

function ShowMapWindow(obj){
	obj.href = '/showmapwindows.html';
	Modalbox.show(obj.href, {title: obj.title, width: 1024, height: 550, beforeHide: function(){GUnload()}, afterLoad: function(){GoogleMapInicialize()}});
}

function ShowMyGalleryWindow(obj){
	obj.href = '/showmygallerywindow.html';
	objopacity = document.getElementById('fullimagepreview');

	Modalbox.show(obj.href, {title: obj.title, width: 800, height: 600});
}

function scrolldivbysteph(divid, step, equal){
	var obj = document.getElementById(divid)

	if (equal){
		obj.scrollLeft = step;
	} else {
		obj.scrollLeft += step;
	}

	percent_now = Math.round((obj.scrollLeft*100) / obj.scrollWidth);

	document.getElementById('bar123').style.left = percent_now +'px';
}

var chatwindowopen = false;
var fullphotobox_open = false;
var chatusersupdate = 0;
var ajax = new Array();

function screenlock(b){	if (b) {
		document.getElementById('screenlocker').style.display = "block";
	} else {		document.getElementById('screenlocker').style.display = "none";
	}
}

				function Loading(index,b){
					//var obj = document.getElementById('loadingProcess');
					var obj = document.getElementById('mouse_loader_box');


					if (b) {
						obj.style.display = 'block';
						document.body.style.cursor = 'wait';
						//obj.innerHTML = '';
						//obj.innerHTML = '<img style="border:0px;" src="http://cikavo.com/libs/loader.gif">';
					} else {
						obj.style.display = 'none';
						document.body.style.cursor = 'default';
      					//obj.innerHTML = '';
					}


				}

   				function RunLink(sel) {
					var index = ajax.length;
					ajax[index] = new sack();

					ajax[index].requestFile =sel.href;	// Specifying which file to get
						ajax[index].onLoading = function(){ Loading(index, 1) };
						ajax[index].onLoaded = function(){ Loading(index, 0) };
						ajax[index].onCompletion = function(){ RefreshData(index, sel) };
						ajax[index].runAJAX();		// Execute AJAX function
				}



   				function RunPost(sel) {
					var index = ajax.length;
					ajax[index] = new sack();
					formname = sel.id;



                    var form = document.getElementById(formname);

					//ajax[index].setVar("username", form.username.value);

					for(i=0; i<form.elements.length; i++) {
						ajax[index].setVar(form.elements[i].name, form.elements[i].value);

                   	}

						ajax[index].requestFile =sel.action;	// Specifying which file to get
						ajax[index].method='POST';
						ajax[index].onLoading = function(){ Loading(index, 1) };
						ajax[index].onLoaded = function(){ Loading(index, 0) };
						ajax[index].onCompletion = function(){ RefreshData(index, sel) };
						ajax[index].runAJAX();		// Execute AJAX function

				}

				function RefreshData(index, sel)
				{

					if (!document.getElementById(sel.target)){
						return false;
					}

					var obj = document.getElementById(sel.target);
					//eval(ajax[index].response);	// Executing the response from Ajax as Javascript code
					obj.innerHTML = ajax[index].response;

                    if (obj.innerHTML == 'LoGOk'){
                    	obj.innerHTML = '';
                    	ShowWindowMessage('Авторизація: ОК', '<center><p>Ви Вдало увійшли в систему</p><a href="#" title="Закрити" id="myproflink" onClick="Modalbox.hide(); return false;"><img src="http://cikavo.com/moduls/images/btn_close.jpg" border="0px" alt="Закрити"></a> </center>');
                    	RunLink(document.getElementById('refreshusermenu'));
                    	UpdateSiteAfterLogin();
                    }

                    if (obj.innerHTML == 'LogEdOuT'){
                    	obj.innerHTML = '';
                    	RunLink(document.getElementById('refreshusermenu'));
                    	//window.location = 'http://cikavo.com';
                    	UpdateSiteAfterLogin();
                    }

                    if (obj.innerHTML == 'ReGOk'){
                    	obj.innerHTML = '';
                    	ShowWindowMessage('Реєстрація: ОК', '<p>Ви Вдало пройшли реєстрацію. Дані про реєстрацію вислано Вам на E-mail. <BR>Тепер Ви можете увійти до системи. <a href=\"\" title=\"Вхід\" onclick="Modalbox.show(\'/login.html\', {title: \'Вхід\', width: 300, height: 250});return false;\">Вхід</a>');
                    }

                    if (obj.innerHTML == 'FoRgOtPaSS'){
                    	obj.innerHTML = '';
                    	ShowWindowMessage('Відновлення пароля', '<center><p>Ваш новий пароль вислано Вам на E-mail.</p><a href="#" title="Закрити" id="myproflink" onClick="Modalbox.hide(); return false;"><img src="http://cikavo.com/moduls/images/btn_close.jpg" border="0px" alt="Закрити"></a> </center>');
                    }

                    if (obj.innerHTML == 'ChanGePaSS'){
                    	obj.innerHTML = '';
                    	ShowWindowMessage('Зміна пароля', '<center><p>Пароль змінено.</p><a href="#" title="Закрити" id="myproflink" onClick="Modalbox.hide(); return false;"><img src="http://cikavo.com/moduls/images/btn_close.jpg" border="0px" alt="Закрити"></a></center>');
                    }
                    if (obj.innerHTML == 'PrOfIleWiNdow'){
                    	obj.innerHTML = '';
                     	Modalbox.show('/myprofile.html', {title: 'Моя Сторінка', width: 450, height: 250});
                    }
                    if (obj.innerHTML.substr(0,15) == 'AdDcHaTMessAGe:'){
                     	//Modalbox.show('myprofile.html', {title: 'Моя Сторінка', width: 450, height: 250});
                     	//var textmsg = obj.innerHTML.substr(15);
                        obj.innerHTML = '';
                        //UpdateChatWindow(textmsg);
                    }

				}

	  function startUpload(){
      	//document.getElementById('f1_upload_process').style.visibility = 'visible';

      	document.getElementById('f1_upload_process').innerHTML = 'Завантаження...';
      	return true;
      }

      function stopUpload(success, filename, height){
      	var result = '';

      	if (success == 2){            gallery_photo_uploaded_add(filename, height);
            document.getElementById('gallery_uploadphoto_block').innerHTML = '<img src="/cache/gallery/'+filename+'">';
      		return true;
      	}

      	if (success == 1){
      		Modalbox.show('<iframe frameborder="0" id="upload_target" name="upload_target" src="http://cikavo.com/moduls/login/avatar/crop.php?filename='+filename+'&height='+height+'" style="width:100%;height:100%;border:none; background:#EFEFEF;"></iframe>', {title: 'Редагування Персонального фото', width: 800, height: 600});
      	}
      	else {
      		document.getElementById('f1_upload_process').innerHTML ='<span class="emsg">Помилка при завантаженні файлу<\/span><br/><br/>';
      	}

      	return true;
      }


      function EndUpdateAvatar(filename){
      		Modalbox.show('<center><h1>Зображення Збережено</h1><img src="/users/avatars/'+filename+'" /></center>', {title: 'Редагування Персонального фото', width: 400, height: 250});
            var obj = document.getElementById('tech_a_tag');
            obj.href='/moduls/login/process.php?task=updateavatar&username='+filename;
            obj.target='loadingProcess';
            obj.onClick='RunLink(this); return false';
            RunLink(obj);
            RunLink(document.getElementById('refreshusermenu'));
            UpdateSiteAfterLogin();
      	return true;
      }

	function BackToPhotoUpload(filename){
      		Modalbox.show('/addfoto.html', {title: 'Завантажити Своє Фото', width: 450, height: 340});

      		var obj = document.getElementById('tech_a_tag');
            obj.href='/moduls/login/process.php?task=uncacheimg&username='+filename;
            obj.target='';
            obj.onClick='RunLink(this); return false';
            RunLink(obj);
      	return true;
      }

     function checkuplavatarform(){
			if (document.getElementById('image').value==""){
				document.getElementById('f1_upload_process').innerHTML ='<span class="emsg">Потрібно Вибрати файл!<\/span><br/><br/>';
				return false;
			}
			startUpload();
			return true;
		}



        function CheckEmailValue(){

			var obj = document.getElementById('email');
			if (obj.value != "") {
				valid_chars  ="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
				valid_chars += "1234567890";
				valid_chars += "-@_.";
				str=obj.value;
				valid_string = true;
	    		for(i=0; i < str.length; i++ ) {
	       			current_valid_char = false;
	       			for(j=0; j < valid_chars.length; j++) {
	           			if(str.charAt(i) == valid_chars.charAt(j)){
	               			current_valid_char = true;
	             		}
	         		}
	       			if(current_valid_char == false){
	          			valid_string = false;
	         		}
	     		}


				if (valid_string==true){
					if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(obj.value)){
						return true;
					}
	   			}

				return false;
        	}
        }

	function CeckRegisterData(){
		if (CheckEmailValue()==true){
			RunPost(document.getElementById('regform'));
			return false;
		}

		document.getElementById('loadingProcess').innerHTML = '<span class="emsg">Будь-ласка, Вкажіть коректний E-mail.</span>';
		return false;
	}

	function checkprofilEmail(){

			if (CheckEmailValue()==true){
			RunPost(document.getElementById('profileform'));
			return false;
		}

		document.getElementById('loadingProcess').innerHTML = '<span class="emsg">Будь-ласка, Вкажіть коректний E-mail.</span>';
		return false;

	}


		 function loadJSScript(source){
    		var scriptElem = document.createElement('script');
    			scriptElem.setAttribute('src',source);
    			scriptElem.setAttribute('type','text/javascript');
    			document.getElementsByTagName('head')[0].appendChild(scriptElem);

   		}

	function UpdateChatData (){
        if (document.getElementById('chatnewmessage').value == ''){
        	document.getElementById('chatnewmessage').focus();
        	return false;
        }

        RunPost(document.getElementById('writechatmessform'));
        document.getElementById('chatnewmessage').value='';
        document.getElementById('chatnewmessage').focus();
		return false;
	}

	function UpdateChatWindow(text){

      	var oldtxt = document.getElementById('chattextarea').innerHTML;
      	document.getElementById('chattextarea').innerHTML = text+oldtxt;

	}


function CheckAllNewUpdates(){
        CheckChatMessUpdates();

		if ((document.getElementById('chat_useronline_wind')) &&(document.getElementById('chat_useronline_wind').style.display == 'block')){

			chatusersupdate = chatusersupdate + 1;
			if (chatusersupdate > 5){
				chatusersupdate = 0;
				chatwindowopen = false;
				ShowOnlineChatUsr();
			}
		}

        window.setTimeout('CheckAllNewUpdates()',3000);

}

function CheckChatMessUpdates(){

        if (document.getElementById('chattextarea')){
        	RunCheckChatMsgHide('/cecknewchatmessages.html');
        } else {
        	if (document.getElementById('newmsgs')){
        		RunCheckMsgsmallHide('/cecknewmsg.html');
        	}
        }
}


function RunCheckChatMsgHide(href) {
	var index = ajax.length;
	ajax[index] = new sack();

	ajax[index].requestFile =href;	// Specifying which file to get
	ajax[index].onCompletion = function(){ RefreshChatData(index) };
	ajax[index].runAJAX();		// Execute AJAX function
}

function RunCheckMsgsmallHide(href) {
	var index = ajax.length;
	ajax[index] = new sack();

	ajax[index].requestFile =href;	// Specifying which file to get
	ajax[index].onCompletion = function(){ RefreshMsgData(index) };
	ajax[index].runAJAX();		// Execute AJAX function
}

function RefreshChatData(index){
	var msg = ajax[index].response;
	if (msg){
		UpdateChatWindow(msg);
	}
}

function RefreshMsgData(index){
	var msg = ajax[index].response;

	if (document.getElementById('newmsgs')){
		if (msg){
			//alert(':'+msg+':');
			//document.getElementById('newmsgs').style.display='block';
			document.getElementById('newmsgs').src='http://cikavo.com/moduls/images/chat_newmsg.gif';
		} else {
			//document.getElementById('newmsgs').style.display='none';
			document.getElementById('newmsgs').src='http://cikavo.com/moduls/images/chatbtnmenu.jpg';

		}
	}
}

function ShowOnlineChatUsr(){
	document.getElementById('chatnewmessage').focus();
	if (!chatwindowopen){
		var w = document.getElementById('MB_window').style.width;
   		var l = document.getElementById('MB_window').style.left;
   		document.getElementById('chat_useronline_wind').style.left = (parseInt(w)+parseInt(l))+'px';
   		//document.getElementById('chat_useronline_wind').style.top = 'expression( ( 30 + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + \'px\' );';
   		document.getElementById('chat_useronline_wind').style.display = 'block';
   		chatwindowopen = true;
        RunLink(document.getElementById('showchatuseronline'));
   	} else {
		document.getElementById('chat_useronline_wind').style.display = 'none';
		chatwindowopen = false;
   	}
   	return false;

}

function CloseOlineChatUsr(){
	document.getElementById('chat_useronline_wind').style.display = 'none';
	chatwindowopen = false;
}

function Chatbox_InsertSmile(smile){
	var cmsg = document.getElementById('chatnewmessage');
    insertAtCursor(cmsg, smile);
    return false;
}


function insertAtCursor(myField, myValue) {
  //  Для MSIE
  if (document.selection) {
    myField.focus();
    sel = document.selection.createRange();
    sel.text = myValue;
  }
  // Для нормальних броузерів
  else if (myField.selectionStart || myField.selectionStart == '0') {
    var startPos = myField.selectionStart;
    var endPos = myField.selectionEnd;
    myField.value = myField.value.substring(0, startPos) + myValue + myField.value.substring(endPos, myField.value.length);
    myField.focus();
  }
  // Для інших ;)
  else {
    myField.value += myValue;
  }
}


function UpdateSiteAfterLogin(){
	if (document.getElementById('comment_addfrm')){
        //alert('test');
		var id_cont = document.getElementById('id_cont').value;

        var obj = document.getElementById('tech_a_tag');
        obj.href='http://cikavo.com/commentrfm/'+id_cont+'.html';
        obj.target='comment_addfrm';
        obj.onClick='RunLink(this); return false';
        RunLink(obj);
	}
}

function fireEvent(obj,evt){

	var fireOnThis = obj;
	if( document.createEvent ) {
	  var evObj = document.createEvent('MouseEvents');
	  evObj.initEvent( evt, true, false );
	  fireOnThis.dispatchEvent(evObj);
	} else  {
	  fireOnThis.fireEvent('on'+evt);
	}
}

function Comment_InsertSmile(smile){
	var cmsg = document.getElementById('comment_text');
    insertAtCursor(cmsg, smile);
    return false;
}

//*** Friends Block **
function userprof_friendship(obj, type, id){
	obj.target = 'userprof_frndbut';
	obj.href = '';

	if (type==1)
		obj.href = '/addfriend/'+id+'.html';
	if (type==0)
		obj.href = '/delfriend/'+id+'.html';

	if (obj.href)
		RunLink(obj)
}

function myfriends_tabs(obj, type){
	obj.target = 'myfriendwindow_block';
	obj.href = '/myfriendswind/'+type+'.html';
	RunLink(obj)
}

function myfriends_friendship_confirm(obj, id){
	obj.target = 'myfriendwindow_block';
	obj.href = '/friendship_confirm/'+id+'.html';

	RunLink(obj)
}

function myfriends_friendship_destroy(obj, id){
	obj.target = 'myfriendwindow_block';
	obj.href = '/friendship_destroy/'+id+'.html';

	RunLink(obj)
}

function ActivateBackLink(){
        var obj = document.getElementById('tech_a_tag');
        obj.href='http://cikavo.com/backlinkactivation.html';
        obj.target='';
        obj.onClick='RunLink(this); return false';
        RunLink(obj);
}

//*** End Friends Block **


//*** Gallery Block **
function showhide_popup(obj){
	var myobj = document.getElementById(obj);
    if (myobj.style.display=='block'){    	myobj.style.display='none';
    } else {
    	myobj.style.display='block';
    }
    document.getElementById('mygallery_newalbum_name').value = "";
}

function gallery_photo_uploaded_add(filename, height){	var obj = document.getElementById('gallery_uploadphoto_block');

	obj.style.width="96%";
	obj.style.height="380px";
	obj.style.padding="20px 0px 0px 20px";
	obj.style.margin="20px auto 0px auto";
	//obj.style.text-align="left";

    var obj = document.getElementById('tech_a_tag');
	    obj.href='http://cikavo.com/gallery_add_new_photo_form2/'+filename+'.html';
        obj.target='gallery_uploadphoto_block';
        obj.onClick='RunLink(this); return false';
        RunLink(obj);

}

function gallery_check_add_fields(){	if (document.getElementById('image_name').value==""){
		document.getElementById('f1_upload_process').innerHTML ='<span class="emsg">Потрібно вказати Назву!<\/span><br/><br/>';
		return false;
	}
	return true;

}

function gallery_get_my_media(){	var albid = document.getElementById('albsel').value;

    var obj = document.getElementById('tech_a_tag');
	    obj.href='http://cikavo.com/show_gallery_mymedia/'+albid+'.html';
        obj.target='gallery_content';
        obj.onClick='RunLink(this); return false';


        RunLink(obj);
}


function ShowFullPhotoBox_activate(obj){
   		Loading(1, 0);
        var obj_box = document.getElementById('fullimagepreview');
        obj_box.style.opacity = '0';
        obj_box.style.filter = 'alpha(opacity=0)';
   		obj_box.style.display = 'block';

   		var cw = document.body.clientWidth;
		var ch = document.body.clientHeight;
		var fi_w = parseInt(obj.width);
		var fi_h_orig = parseInt(obj.height);
		var fi_h = fi_h_orig;



        if (fi_h > ch) {
        	fi_h = ch - 20;
        	fi_w = Math.ceil(fi_h*fi_w/fi_h_orig);

        	//alert(fi_w+'x'+fi_h);
        	document.getElementById('fullphotoimg').style.width = fi_w+'px';
        	document.getElementById('fullphotoimg').style.height = fi_h+'px';
        }

		obj_box.style.width = fi_w+'px';
		obj_box.style.height = fi_h+'px';
		obj_box.style.left = Math.ceil((cw - fi_w)/2)+'px';
		obj_box.style.top = Math.ceil((ch - fi_h)/2)+'px';
		//document.getElementById('fullimagepreview').style.opacity = 1;
   		//document.getElementById('fullimagepreview').style.display = 'block';

	    if (document.getElementById('albsel') && isMSIE){
        	document.getElementById('albsel').style.visibility='hidden';
        }

   		ShowopacityFullPhotoBox(fi_w);
        //document.getElementById('fullphotoimg').style.display='block';
//        document.getElementById('fullphotoimg').style.visibility='visible';
		//document.getElementById('fullphotoimg').style.filter='';

		document.getElementById('fullimagepreview_prev').style.visibility='visible';
		document.getElementById('fullimagepreview_next').style.visibility='visible';

		document.getElementById('fullimgprev_slideshow').style.visibility='visible';
   		fullphotobox_open = true;
}


function ShowFullPhotoBox(obj){

        var img = obj.href;
        var listimageid  = obj.id;
        var imageid  =parseInt(listimageid.substring(10));

		var prev_id = imageid - 1;
		var next_id = imageid + 1;

		if (prev_id < 1){ prev_id = 1;}
		var obj_prev = document.getElementById('fullphoto_'+prev_id);

		if (!document.getElementById('fullphoto_'+next_id)){
			next_id = 1;
		}
		// else {
		var obj_next = document.getElementById('fullphoto_'+next_id);
		//}

		//global for slideshow
		mygal_slidshow_next = obj_next;

        var prev_link = '<a id="'+obj_prev.id+'" href="'+obj_prev.href+'" onclick="screenlock(1); Loading(1, 1);HideFullPhotoBox();ShowFullPhotoBox(this); return false;" title="'+obj_prev.title+'"></a>';

		//if (next_id !=0){
        var next_link = '<a id="'+obj_next.id+'" href="'+obj_next.href+'" onclick="screenlock(1); Loading(1, 1);HideFullPhotoBox();ShowFullPhotoBox(this); return false;" title="'+obj_next.title+'"></a>';

		//}
		// else {		//	next_link = '<img src="http://cikavo.com/moduls/images/right_arrow8.png" />';
		//}

		if (imageid == 1) {
			prev_link = '';
		}

        img  = img.substring(18);   //crop http://cikavo.com/

		if (!mygal_slidshow) {
			var slideshow_link = '<a id="mygal_slidesh_start_a" href="" onclick="mygallery_startslideshow(); return false"></a>';
		} else {			var slideshow_link = '<a id="mygal_slidesh_stop_a" href="" onclick="mygallery_stopslideshow(); return false"></a>';
		}

		var imgsrc = 'http://cikavo.com/users/gallery/'+img+'.jpg';
		var fulphotohtml = '<div id="fullimagepreview_prev">'+prev_link+'</div>';
		fulphotohtml = fulphotohtml + '<a href="" onclick="mygallery_stopslideshow(); HideFullPhotoBox();screenlock(0); return false;"><img id="fullphotoimg" onload="ShowFullPhotoBox_activate(this);" src="'+imgsrc+'" alt="" style="border:0px;visibility:hidden;"></a>';
		fulphotohtml = fulphotohtml + '<div id="fullimagepreview_next">'+next_link+'</div>';
		fulphotohtml = fulphotohtml + '<div id="fullimgprev_slideshow">'+slideshow_link+'</div>';

        document.getElementById('fullimagepreview').innerHTML = fulphotohtml;

        //document.getElementById('fullphotoimg').style.visibility='hidden';
		//document.getElementById('fullphotoimg').style.filter='alpha(opacity=0)';

        //RunLink(document.getElementById('showchatuseronline'));
   	//} else {
	//	document.getElementById('chat_useronline_wind').style.display = 'none';
	//	chatwindowopen = false;
   	//}
   	return false;

}

function HideFullPhotoBox(){
    if (document.getElementById('fullphotoimg').style.visibility!='hidden'){
		document.getElementById('fullphotoimg').style.visibility='hidden';
		document.getElementById('fullimagepreview_prev').style.visibility='hidden';
		document.getElementById('fullimagepreview_next').style.visibility='hidden';
		document.getElementById('fullimgprev_slideshow').style.visibility='hidden';
	}

	op = (objopacity.style.opacity)?parseFloat(objopacity.style.opacity):parseInt(objopacity.style.filter)/100;

	if(op > 0) {
		clearTimeout(t2);
		op -= 0.2;
		objopacity.style.opacity = op;
		objopacity.style.filter='alpha(opacity='+op*100+')';
		t=setTimeout(function () {HideFullPhotoBox()},15);

    } else {    	objopacity.style.display = 'none';

    if (document.getElementById('albsel') && isMSIE){
        	document.getElementById('albsel').style.visibility='visible';
        }

    }



}

function ShowopacityFullPhotoBox(wid){

	op = (objopacity.style.opacity)?parseFloat(objopacity.style.opacity):parseInt(objopacity.style.filter)/100;

	if(op < 1) {
	    if (document.getElementById('fullimagepreview_prev').style.visibility!='hidden'){
	    		document.getElementById('fullphotoimg').style.visibility='hidden';
				document.getElementById('fullimagepreview_prev').style.visibility='hidden';
				document.getElementById('fullimagepreview_next').style.visibility='hidden';
				document.getElementById('fullimgprev_slideshow').style.visibility='hidden';

	    }
		clearTimeout(t);
		op += 0.2;
		objopacity.style.opacity = op;
		objopacity.style.filter='alpha(opacity='+op*100+')';
		t2=setTimeout(function () {ShowopacityFullPhotoBox();},15);
    } else {
		    document.getElementById('fullphotoimg').style.visibility='visible';
			document.getElementById('fullimagepreview_prev').style.visibility='visible';
			document.getElementById('fullimagepreview_next').style.visibility='visible';
			document.getElementById('fullimgprev_slideshow').style.visibility='visible';
    }
}

function CloseFullPhotoBox(){
	mygallery_stopslideshow();
	objopacity.style.display = 'none';
	objopacity.style.display = 'none';
	objopacity.style.display = 'none';
    if (document.getElementById('albsel') && isMSIE){
       	document.getElementById('albsel').style.visibility='visible';
    }

	chatwindowopen = false;
	screenlock(0);
}

function mygallery_startslideshow(){	var slide_navig = document.getElementById('mygal_slidesh_start_a');
    slide_navig.onclick = function(){mygallery_stopslideshow(); return false;};
    slide_navig.id = 'mygal_slidesh_stop_a';
	mygal_slidshow = true;

	document.getElementById('fullimagepreview_prev').style.visibility='hidden';
	document.getElementById('fullimagepreview_next').style.visibility='hidden';


	setTimeout(function(){			screenlock(1);
			Loading(1, 1);
			HideFullPhotoBox();
			ShowFullPhotoBox(mygal_slidshow_next);
            tss = setTimeout(arguments.callee, 5000);
			}, 5000);
}

function mygallery_stopslideshow(){
	clearTimeout(tss);
	mygal_slidshow = false;
	if (document.getElementById('mygal_slidesh_stop_a')){
		var slide_navig = document.getElementById('mygal_slidesh_stop_a');
    	slide_navig.onclick = function(){mygallery_startslideshow(); return false;};
    	slide_navig.id = 'mygal_slidesh_start_a';

		document.getElementById('fullimagepreview_prev').style.visibility='visible';
		document.getElementById('fullimagepreview_next').style.visibility='visible';

    }
}

//*** End Gallery Block **