function ms_dispnav()
{
	if(arguments.length < 2)return;
	var tell = arguments[0];
	for(var i = 1; i < arguments.length; i++)
	{
		var nav = document.getElementById(arguments[i] + "_nav");
		var content = document.getElementById(arguments[i] + "_content");
		if(!nav || !content)continue;
		if(tell == i)
		{
			nav.className = i == arguments.length - 1 ? "active end" : "active";
			content.style.display = "";
		}
		else
		{
			nav.className = i == arguments.length - 1 ? "normal end" : "normal";
			content.style.display = "none";
		}
	}
}
function resultpage()
{
if(document.getElementById("page0"))
{
  var $page;
  for($i=0;$i<11;$i++)
  {
    if(!document.getElementById("page"+$i)) continue;
 
	 $page=document.getElementById("page"+$i).innerHTML;
	 document.getElementById("page"+$i).innerHTML=pagetotalnum-$page;
  }
}
}
function addloadEvent(func)
{
  var oldonload=window.onload;
  if(typeof window.onload!='function')
  {
     window.onload=func;
  }else
  {
     window.onload=function(){
	   oldonload();
	   func();
	 }
  }
}
addloadEvent(resultpage);
function updataip(ip)
{
	ms_dispnav(2,'ipsearch','ipsubmit','websearch');
	var theform = document.forms['ipsubmit'];
	theform.elements["upip"].value = ip;
	theform.elements["upaddr"].focus();
}

			function setTransition(){
			   if (document.all){
				  bannerADrotator.filters.revealTrans.Transition=Math.floor(Math.random()*23);
				  bannerADrotator.filters.revealTrans.apply();
			   }
			}
			
			function playTransition(){
			   if (document.all)
				  bannerADrotator.filters.revealTrans.play()
			}
			function show(n,url)
			{
               t=adNum+1;
			      document.getElementById("pic_"+t).className="picpage";			  
			      document.getElementById("pic_"+n).className="picaction";
			   if(n==0)
			   {
				 adNum=0;
			   }else
			   adNum=n-1;			   
			   document.images.bannerADrotator.src=url;			   
			   document.getElementById("pmsg").innerHTML=bannerADtext[adNum];
			}
			function nextAd(){
			   if(adNum<bannerAD.length-1)adNum++ ;
				  else adNum=0;
			   setTransition();
			   document.images.bannerADrotator.src=bannerAD[adNum];
			   playTransition();
			   document.getElementById("pmsg").innerHTML=bannerADtext[adNum];
			   
			   if(adNum==0)
			   {
				  t=bannerAD.length;
				  if(document.getElementById("pic_"+t))
			      document.getElementById("pic_"+t).className="picpage";
			   }else
			   {
				  if(document.getElementById("pic_"+adNum))
			      document.getElementById("pic_"+adNum).className="picpage";
			   }
			   t=adNum+1;
			   if(document.getElementById("pic_"+t))
			   document.getElementById("pic_"+t).className="picaction";
			   theTimer=setTimeout("nextAd()", 7000);		
			}
			function clearad()
			{
			  if(kad==1)
			  {
			    nextAd();
				kad=0;
			  }else{
			     clearTimeout(theTimer);
				 kad=1;
			  }
			}
			function jump2url(){
			   jumpUrl=bannerADlink[adNum];
			   jumpTarget='_blank';
			   if (jumpUrl != ''){
				  if (jumpTarget != '')window.open(jumpUrl,jumpTarget);
				  else location.href=jumpUrl;
			   }
			   return false;
			}
			function displayStatusMsg() { 
			   status=bannerADlink[adNum];
			   document.returnValue = true;
			}
            function avpic(n,url)
			{
			  if(n==0)
			   {
				 adNum=0;
			   }else
			   adNum=n-1;			   
			   document.images.bannerADrotator.src=url;			   
			   document.getElementById("pmsg").innerHTML=bannerADtext[n];
			   return false;
			}
			function nextshow()
			{
			   adNum=adNum+1;			   
			   if(adNum>=bannerAD.length)
			   {
			     adNum=0;
			   }
			   document.images.bannerADrotator.src=bannerAD[adNum];			   
			   document.getElementById("pmsg").innerHTML=bannerADtext[adNum];
			}
function addloadEvent(func)
{
  var oldonload=window.onload;
  if(typeof window.onload!='function')
  {
     window.onload=func;
  }else
  {
     window.onload=function(){
	   oldonload();
	   func();
	 }
  }
}

/* addEvent: simplified event attachment */
function addEvent( obj, type, fn ) {
	if (obj.addEventListener) {
		obj.addEventListener( type, fn, false );
		EventCache.add(obj, type, fn);
	}
	else if (obj.attachEvent) {
		obj["e"+type+fn] = fn;
		obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
		obj.attachEvent( "on"+type, obj[type+fn] );
		EventCache.add(obj, type, fn);
	}
	else {
		obj["on"+type] = obj["e"+type+fn];
	}
}
	
var EventCache = function(){
	var listEvents = [];
	return {
		listEvents : listEvents,
		add : function(node, sEventName, fHandler){
			listEvents.push(arguments);
		},
		flush : function(){
			var i, item;
			for(i = listEvents.length - 1; i >= 0; i = i - 1){
				item = listEvents[i];
				if(item[0].removeEventListener){
					item[0].removeEventListener(item[1], item[2], item[3]);
				};
				if(item[1].substring(0, 2) != "on"){
					item[1] = "on" + item[1];
				};
				if(item[0].detachEvent){
					item[0].detachEvent(item[1], item[2]);
				};
				item[0][item[1]] = null;
			};
		}
	};
}();
addEvent(window,'unload',EventCache.flush);

/* grab Elements from the DOM by className */
function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

/* toggle an element's display */
function toggle(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != 'none' ) {
		el.style.display = 'none';
	}
	else {
		el.style.display = '';
	}
}

/* insert an element after a particular node */
function insertAfter(parent, node, referenceNode) {
	parent.insertBefore(node, referenceNode.nextSibling);
}

/* Array prototype, matches value in array: returns bool */
Array.prototype.inArray = function (value) {
	var i;
	for (i=0; i < this.length; i++) {
		if (this[i] === value) {
			return true;
		}
	}
	return false;
};

/* get, set, and delete cookies */
function getCookie( name ) {
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
		return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}
	
function setCookie( name, value, expires, path, domain, secure ) {
	var today = new Date();
	today.setTime( today.getTime() );
	if ( expires ) {
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	document.cookie = name+"="+escape( value ) +
		( ( expires ) ? ";expires="+expires_date.toGMTString() : "" ) + //expires.toGMTString()
		( ( path ) ? ";path=" + path : "" ) +
		( ( domain ) ? ";domain=" + domain : "" ) +
		( ( secure ) ? ";secure" : "" );
}
	
function deleteCookie( name, path, domain ) {
	if ( getCookie( name ) ) document.cookie = name + "=" +
			( ( path ) ? ";path=" + path : "") +
			( ( domain ) ? ";domain=" + domain : "" ) +
			";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

/* quick getElement reference */
function analyse()
{
  var agent=new Array();
  if(jQuery.browser.msie)
  {
    agent['browser']="ie";
  }else if(jQuery.browser.mozilla)
  {
    agent['browser']="mozilla";
  }else{
    agent['browser']="other";
  }
  agent['version']=jQuery.browser.version;
  agent['width']=window.screen.width;
  agent['height']=window.screen.height;
  agent['href']=encodeURIComponent(window.location.href);
  agent['url']=encodeURIComponent(document.referrer);
  jQuery.get("/analyse.php",{browser:agent['browser'],version:agent['version'],width:agent['width'],height:agent['height'],href:agent['href'],referrer:agent['url']});
}
addloadEvent(analyse);
function inputclass()
{
	
  if (jQuery.browser.msie){
		jQuery("input[@type='text'], input[@type='password'], textarea").focus(function(){jQuery(this).css({background:"#fcc", border:"1px solid #f00"})}).blur(function(){jQuery(this).css({background: "url() none repeat scroll 0%", border: "1px solid #ccc"})});
		}
  
}
addloadEvent(inputclass);
function mailcheck(mail1){
			var pateer=/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9])+/;
			var flag=pateer.test(mail1);
			return flag;
		}      
function checkgbook(objid)
{
	if(objid.author.value==""){
                alert(objid.author.title);
                return false;      
            }
   if(!mailcheck(objid.email.value)){
            	alert(objid.email.title);
            	return false;
            }   
	   if(objid.checkVnum.value==""){
            	alert(objid.checkVnum.title);
            	return false;
            }
	document.getElementById("checkVnum").name="checknum";
}
function showaddbook()
{
  jQuery("#gbookadd").show();
  jQuery("#addbook").hide();
}
var str="";
function checkDomain(obj)
{
  if(obj.DomainName.value=="")
  {
    alert(obj.DomainName.title);
	obj.DomainName.focus();
	return false;
  }
  var i=0;
  jQuery("#showdomain").show();
  if(str=="")
    str=document.getElementById("showdomain").innerHTML;
  suffix="";
  jQuery(".suffix").each(function(){
     if(this.checked==true)
	 {
	   suffix=suffix+"&suffix[]="+this.value;
	   i++;
	 }
  });
  var j=Math.random();
  if(i>0)
  {
    jQuery.ajax({url:"domain_search.php",
	  type:"post",
	  dateType:"html",
	  data:"action=1&DomainName="+obj.DomainName.value+"&check=Search"+suffix+"&j="+j,
	  complete:function(msg){
	    jQuery("#showdomain").html(msg.responseText);		
		hidedomain(9);
		jQuery("#reg_domain").hide();
	  }
	});
  }else{
    alert("select domain!");
  }
  
  return false;
}
function hidedomain(im)
{
  if(im==1)
	{
      jQuery("#showdomain").hide();
	  document.getElementById("showdomain").innerHTML=str;
	  jQuery("#reg_domain").show();
	}else{

	   setTimeout("hidedomain(1)",9000);	  
	}
}