var Tout;
function Toggle(id1,id2,obj,color){

  setTimeout(function(){ChangeColor(obj,color);},0);
  document.getElementById(id1).style.display ="none";
  document.getElementById(id2).style.display ="block";  
}
function ChangeColor(obj,color){
 obj.style.backgroundColor ="#"+color;
}
function linkMouseOver(obj){
 obj.style.backgroundColor ="#A33905";
 obj.style.color  = "#fff";

}
function linkMouseOut(obj){
 obj.style.backgroundColor="#fff";
 obj.style.color="#000";

}
function show(id,num){
 for(i=0;i<num;i++){
   if(document.getElementById('subm'+i)){
     document.getElementById('subm'+i).style.display="none";}
 }
 for(var i in document.getElementById('subm'))
   alert(i);
 if(Tout!="") clearTimeout(Tout); 
   document.getElementById('subm'+id+'').style.display="block";
}
function hide(id){
 if(Tout!="") clearTimeout(Tout); 
   Tout=setTimeout("document.getElementById('subm"+id+"').style.display='none'",500);
}
function lang(lang)
{
 var current=window.location.href;
 var new_loc;
 if(/lang=/.test(current))
   new_loc=current.replace(/lang=\w*/,"lang="+lang);
 else if(/\?/.test(current))
   new_loc=current+"&lang="+lang;
 else 
   new_loc=current+"?lang="+lang;  
 window.location.replace(new_loc);
}
var send = function(link){
 var dataToSend = document.getElementById('calendar_y').value+"."+document.getElementById('calendar_m').value;
 var ajax = new httpAjaxRequest(); 
 if(ajax)
  {  
     ajax.prepareHash({date:dataToSend}); 
     ajax.open("GET", "ajax.php");
     ajax.send();
     ajax.getData();
     ajax.onreadystatechange = function()
       { 
           data =ajax.getResult();
           document.getElementById("calendar_div").innerHTML =data.calendar; 
       }  
  }
 else window.location =link + document.getElementById('calendar_y').value+"."+document.getElementById('calendar_m').value; 
}
function showPic(pic,width,height)
{ 
  sDesrc = "width=" + width + ", height=" + height +
  		", status=no, toolbar=no, menubar=no, scrollbars=no";
  win=window.open("Gallery", "", sDesrc);
  win.document.write("<html><style>body{padding:0px;margin:0px;}</style><body>");
  win.document.write("<img src='uploads_script/gallery/"+pic+"' width='"+width+"' height='"+height+"'><br>");
  win.document.write("</body></html>");
  win.document.close();
} 
function sendToFriend(id,width,height)
{ 
  sDesrc = "width=" + width + ", height=" + height +
  		", status=no, toolbar=no, menubar=no, scrollbars=no";
  win    = window.open("sendfriend.php?sendid="+id,"", sDesrc);
}
function writeCookie(cookieName, cookieContent, cookieExpireTime){
	var cookiePath = '/';
	if(cookieExpireTime>0){
		var expDate=new Date()
		expDate.setTime(expDate.getTime()+cookieExpireTime*1000*60*60)
		var expires=expDate.toGMTString()
		document.cookie=cookieName+"="+escape(cookieContent)+";path="+escape(cookiePath)+";expires="+expires+";";
	}
    else
	  document.cookie=cookieName+"="+escape(cookieContent)+";path="+escape(cookiePath)+";";
	
}
function readCookie(cookieName){
	var ourCookie=document.cookie;
	if(!ourCookie || ourCookie=="")return ""
	ourCookie=ourCookie.split(";")
	var i=0;
	var Cookie;
	while(i<ourCookie.length){
		Cookie=ourCookie[i].split("=")[0];
		if(Cookie.charAt(0)==" ")
		Cookie=Cookie.substring(1);
		if(Cookie==cookieName){
			return unescape(ourCookie[i].split("=")[1])
		}
		i++;
	}
	return "";
}
function deleteCookie(cookieName){
	var cookiePath  = '/';
	document.cookie = cookieName+"="+readCookie(cookieName)+";path="+escape(cookiePath)+";expires=Thu, 01-Jan-1970 00:00:01 GMT;";
}

function showVideo(video_id, width, height)
{ 
	sDesrc = "width=" + width + ", height=" + height + ", status=no, toolbar=no, menubar=no, scrollbars=no";
	win = window.open("video.php?video_id=" + video_id + "&width=" + width + "&height=" + height, "", sDesrc);
}
