/*****picpost*****/
function chNevigate(value,type){

     document.form_search.search_type.value=type;
     document.getElementById("head_rtop").style.backgroundPosition=value+"px 7px";
    
}

function openmsg(id){
	var c='';	window.open('http://www.mthai.com/msgbox_new/receive_box.php?receiver_id='+id+'&from=2','showalld2i','top=50,left=100,toolbar=no,location=no,status=1,menubar=no,scrollbars=no,resizable=no,width=250,height=150');
}

/*  javascript ads right  nextback */

/*var ads=4; 
var adsloop;
nowAds=randAds(ads); 


function nowrightAds(){
  chAds(nowAds);
}

if(document.getElementById("frm_ads_r")){
	  replaceAds(nowAds);
}

function hiddenLoad(){
	  document.getElementById("loading_ads").style.display='none';
}

function showLoad(){
	  document.getElementById("loading_ads").style.display='';
}

function replaceAds(nowAds){
	   obj=document.getElementById("frm_ads_r");
	   window.frm_ads_r.location.replace("/ads_index_right.php?id="+nowAds);
	   obj.style.display="none";
	   if(checkBrowser()){
		   obj.filters[0].Apply();    
		   obj.filters[0].Play(); 
	  }
	   obj.style.display="";
	 
}

function randAds(index){ 

			today=new Date();
			jran=today.getTime();
			var MaxNumber = index;
			ia=9301;
			ic=49297;
			im=233280;
			jran = (jran*ia+ic) % im;
			rand = Math.ceil( (jran/(im*1.0)) *MaxNumber);  
			return rand;

} 

function chAds(value){
	   for(c=1;c<=ads;c++){
			if(c==value){
				   showLoad();
				   var divv = document.getElementById('ads'+c);
					var cls = divv.getElementsByTagName('div');
					for (i=0;i<cls.length;i++){
						if(cls[i].className.indexOf('ads_page') != -1) cls[i].className="ads_page_s";
						replaceAds(c);
					}
			}else{
					var divv = document.getElementById('ads'+c);
					var cls = divv.getElementsByTagName('div');
					for (i=0;i<cls.length;i++){
						if(cls[i].className.indexOf('ads_page_s') != -1) cls[i].className="ads_page";
					}
			}

		}//for
}

 function nextAds(){
		   nowAds=nowAds+parseInt(1);
		   if(nowAds>ads)nowAds=1; 
			chAds(nowAds);
			
 }

 function backAds(){
		   nowAds=nowAds-parseInt(1);
		   if(nowAds<1)nowAds=ads; 
		   chAds(nowAds);

 }

function stopAds(){
			//clearInterval(adsloop);
 }
 function startAds(){
			//adsloop=setInterval("nextAds()",15000);
 }*/

  function checkBrowser(){
		
	   if(navigator.appName == "Microsoft Internet Explorer") return true;
	   else  return false;

 }



/*  tabs bottom  */
  function tabb(value){
		   document.getElementById("tab_bottom").style.backgroundImage="url(images/w"+value+".gif)";
		   document.getElementById("tabb"+value).style.color="#83402C";
		   for(c=1;c<=4;c++){
				 if(c==value){
					  		   document.getElementById('data'+c).style.display='';
				 }else{
                               document.getElementById('data'+c).style.display='none';
				 }
		   }

 }


   function checkBlog(){
	  var selectList = document.getElementById("select_blog");
	  var value=selectList[selectList.selectedIndex].value;
	  window.location='whatup.php?menu=menu0&blog_id='+value;
  }

  function goSearch(){
	if(document.getElementById('s').value==""){
		alert("ãÊèª×èÍtag·Õè¨Ð¤é¹ËÒ´éÇÂ¤ÃÑº");
		document.getElementById('s').focus();
	}else{
		window.location='search.php?tag='+document.getElementById('s').value;
	}
}

  function tabb(value){
		   document.getElementById("tab_bottom").style.backgroundImage="url(images/w"+value+".gif)";
		   document.getElementById("tabb"+value).style.color="#83402C";
		   for(c=1;c<=4;c++){
				 if(c==value){
					  		   document.getElementById('data'+c).style.display='';
				 }else{
                               document.getElementById('data'+c).style.display='none';
				 }
		   }

 }

function setCookie(c_name,value,expiredays){
	var exdate=new Date()
	exdate.setDate(exdate.getDate()+expiredays)
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toGMTString())
}

function getCookie(c_name){
	if (document.cookie.length>0){
		c_start=document.cookie.indexOf(c_name + "=");
		if (c_start!=-1){ 
			c_start=c_start + c_name.length+1;
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1) c_end=document.cookie.length
			return unescape(document.cookie.substring(c_start,c_end))
		} 
	}
	return ""
}

function checkCookie(url,id){
		
	if (getCookie(id)==null || getCookie(id)==""){
		document.body.style.behavior='url(#default#homepage)';
		document.body.setHomePage(url);
		//this.setHomePage('http://game.mthai.com');
		setCookie(id,"aa",30);
	}
}
