var __gASN = 'pub-2586913913994876';
 var __sSN = 'XQ_Forum_UTF';

function $() {
  var a = [];
  for (var i = 0; i < arguments.length; i++) {
    var b = arguments[i];
    if (typeof b == 'string')
      b = document.getElementById(b);
    if (arguments.length == 1) 
      return b;
    a.push(b);
  }
  return a;
}

//---g____AD---
function DoGACon(GaWidth,GaHeight,GaInfo,GaType,GaToUrl,GcBorderAndBg,GcTitle,GcTxt,GcUrl) {
	var __gAstr ='<script type=\"text\/javascript\"\><\!--\n';
	if (GaToUrl !='') { __gAstr +='google_alternate_ad_url = \"'+GaToUrl+'\"\;\n';}
	__gAstr +='google_ad_width =\"'+GaWidth+'\"\;\n'
	+'google_ad_client = \"'+__gASN+'\"\;\n'
	+'google_ad_height = \"'+GaHeight+'\"\;\n'
	+'google_ad_format = \"'+GaInfo+'\"\;\n';
	if (GaType !='')	{ __gAstr +='google_ad_type = \"'+GaType+'\"\;\n';}
	__gAstr +='google_ad_channel =\"\"\;\n'
	+'google_color_border = \"'+GcBorderAndBg+'\"\;\n'
	+'google_color_bg = \"'+GcBorderAndBg+'\"\;\n'
	+'google_color_link = \"'+GcTitle+'\"\;\n'
	+'google_color_text = \"'+GcTxt+'\"\;\n'
	+'google_color_url = \"'+GcUrl+'\"\;\n'
	+'\/\/--\><\/script>\n'
	+'<script type=\"text\/javascript\" '+' '+'src=\"http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\"\>'+' '+'<\/script>';	
	document.writeln(__gAstr);
}

function loadGAW(myGatypeE) {
	var myGaT = myGatypeE.toLowerCase();
	var myGaQudao,myGaW,myGaH,myGaID,myGaStr;
	
	if ((myGaT.indexOf('vince_'))!=-1){
		myGaID ='pub-2586913913994876';
	}else {
		myGaID ='pub-4190233654185559';
	}	
	switch(myGaT) {
		case 'contentl_160x600':
			myGaW =160;
			myGaH =600;
			myGaQudao='1287404899';
		break;
		case 'homem_336x280':
			myGaW =336;
			myGaH =280;
			myGaQudao='7887077309';
		break;
		case 'conban_728x90':
			myGaW =728;
			myGaH =90;
			myGaQudao='0748900065';
		break;
		case 'mxqhomemiddle_468x60':
			myGaW =468;
			myGaH =60;
			myGaQudao='8598324056';
		break;
		case 'vince_conban_728x90':
			myGaW =728;
			myGaH =90;
			myGaQudao='6198724452';
			break;
		case 'vince_xqhomemiddle_468x60':
			myGaW =468;
			myGaH =60;
			myGaQudao='4131040007';
		break;		
		case 'vince_xqbboard0_728x90':
			myGaW =728;
			myGaH =90;
			myGaQudao='7560965960';
		break;
		case 'vince_sub160x600':
			myGaW =160;
			myGaH =600;
			myGaQudao='6575472277';
		break;
		default:
			myGaW =160;
			myGaH =600;
			myGaQudao='1287404899';
		break;
		}

		myGaStr='\<\scri\pt type=\"text\/javas\cript\">\<\!--\n'
		+'google_ad_client = \"'+myGaID+'\"\;\n'
		+'\google_ad_slot = \"'+myGaQudao+'\"\;\n'
		+'google_ad_width = '+myGaW+'\;\n'
		+'google_ad_height = '+myGaH+'\;\n'
		+'\/\/--\>\<\/script>\n'
		+'\<scr\ipt type=\"text\/javas\cript\" src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\"\>\n'
		+'\<\/scr\ipt>\n';

	document.write(myGaStr);
}


//=========cookie===========


//=====获取cookie
 function getCookieStr (offset) {
  var endstr = document.cookie.indexOf (';', offset);
  if (endstr == -1) {endstr = document.cookie.length};
  return unescape(document.cookie.substring(offset, endstr));
}

function getCookieStrByname (nameS) {
  var arg = nameS+'=';
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg){return unescape(getCookieStr (j));}
	i = document.cookie.indexOf(' ', i) + 1;
    if (i == 0){break;}
  }
  return null;
}

function getCookieValue(Name){      
	var cookieStr = getCookieStrByname(__sSN)	
	return  cookieStr ? getParaStrValue(Name,cookieStr)	: null;	
	}

 //======设置cookies
function setCookie(iName,iValue,iDays) {
	var cStr = getCookieStrByname(__sSN)
	if (cStr) {
		var oldValue = getCookieValue(iName);		
		if (oldValue) {		
			var nStr = cStr.replace(iName+'='+oldValue,iName+'='+iValue) ;
			setCookieStr(escape(nStr),iDays);
			return;
		}
		serCookieStr(escape(cStr)+'&'+iName+'='+escape(iValue),iDays);
		return;	
	}
	setCookieStr(iName+'='+escape(iValue),iDays);
}

 function setCookieStr(cValue,cDays){
	var c="";
	if(cDays!=-1){
	var c=new Date();
	c.setTime(c.getTime()+3600000*24*cDays);
	c=";expires="+c.toGMTString();
	}
	document.cookie=__sSN+'='+cValue+';path=/;domain='+location.hostname+';'+c;
}
 
//---以&分割的名值对----取值
//---paraName 参数名
function getParaStrValue(paraName,str) {
 	var n = str.indexOf(paraName);
	if (n !=-1){
		var x= (n+paraName.length+1), y= str.indexOf('&',n);
		return ((str.indexOf('&') !=-1)&&(y !=-1)) ? str.substring(x,y) : str.substring(x);	
	}
return null;
}

//-----URL--参数取值
function getURLpara (paraName) {
	var a= window.location.href
	var n= a.indexOf("?");
	if (n !=-1)	{
	return getParaStrValue(paraName,a.substring(n+1));	
	}
	return null
}


//====================

function Ho(a,b){
	var c=a.indexOf(b);
	if(c!=-1){
		var d=a.indexOf(";",c);
			if(d==-1){d=a.length}
			return b(a.substring(c+b.length+1,d))
		}
		return null
	}

function H(a,b){a.style.display=b?"":"none"}
function Nh(a,b){a.style.display=b?"block":"none"}
function RA(a){return a>="a"&&a<="z"||(a>="A"&&a<="Z"||a>="0"&&a<="9")}
function wj(a,b,c){return"<span"+(c?' class="'+c+'"':"")+' onclick="'+b+'">'+a+"</span>"}


function mouseMenu(eID,eTag) {
var mEl =$(eID).getElementsByTagName(eTag) 
 var mEls = mEl.length; 
  if (mEls>=0) {	
	for (var i=0;i<mEls  ;i++ ) 	{
		mEl[i].onmouseover = function() {this.className ="mHover";}
		mEl[i].onMouseDown = function() {this.className ="mHover";}
		mEl[i].onMouseUp = function() {this.className ="mHover";}
		mEl[i].onmouseout = function() {this.className="";}		
	}
 }
}

function clickMenuHide(eID,eTag,eNextTag) {
	if ($(eID))	{
		var cEl = $(eID).getElementsByTagName(eTag);
		var cEls = cEl.length;
		for (var i=0;i<cEls ;i++ ) {
			cEl[i].style.cursor="hand";
			cEl[i].onclick = function() {
			HideTag(eID,eNextTag);
			this.tag = this.nextSibling;
			this.className = ((this.className=='') || (this.className=='normal')) ?	 "sMenu"	:	'';
			if (this.tag){	this.tag.style.display = ((this.tag.style.display=='') || (this.tag.style.display=='block'))	?	"none"	 :	"block";}
			this.style.cusor="default";
			}		
		}
	}
 }

function HideTag(eID,eNextTag) {
	if ($(eID)) {
	var hNextTag = $(eID).getElementsByTagName(eNextTag)
	var hTags = hNextTag.length;
		for (var i=0;i<hTags ;i++ )	{
		hNextTag[i].style.display= "none";
		hNextTag[i].previousSibling.className ="normal";
		}	
	}

}



function imgSizeReload(img,imgwidth,imgheight) {
 img.height=imgheight;
 if (img.width!=0) {
	if(img.width<imgwidth) {
	var imghigh=imgwidth/img.width*imgheight; 
	img.width=imgwidth;
	img.height=imghigh;
	 }
   }else{
   img.width=imgwidth;
  }
}
//深浅行背景
function setListBgDeepLight(idName,tagName,colorValue) {
if ($(idName)){
	var topicListS = $(idName).getElementsByTagName(tagName);
	var tN = topicListS.length;
		for (i=1; i<tN;i=i+2 )	{
		topicListS[i].style.backgroundColor= '#'+colorValue;	
		}
	}
}
//---网页宽度
 function setWebIsWidth(isWidth) {
  if (isWidth)  {
	//setCookie('_isW','1',120);
	$("setWebWidth").innerHTML = "<a href=\"javascript:setWebIsWidth(false);\">→窄←</a>";		
	document.getElementsByTagName('body')[0].style.width = "900px";
  }else {
	//setCookie('_isW','0',120);
	$("setWebWidth").innerHTML = "<a href=\"javascript:setWebIsWidth(true);\">←宽→</a>";		
	document.getElementsByTagName('body')[0].style.width = "768px";  
  }
 } 
 //==pageLoad
 function getWebWidth() {
		document.getElementsByTagName('body')[0].style.borderTopWidth =  ($('siteHead').offsetHeight+5)+"px";
			//$('siteHead').style.width ="930px";

	var isW_Value = getCookieValue('_isW')
	if (isW_Value) { 	 
		if (isW_Value=='1') {
			$("setWebWidth").innerHTML = "<a href=\"javascript:setWebIsWidth(false);\">→窄←</a>";		
			document.getElementsByTagName('body')[0].style.width = "900px";	
			$('siteHead').style.width ="930px";
			//$('siteHead').style.width ="930px";

			return;
		}
		$("setWebWidth").innerHTML= "<a href=\"javascript:setWebIsWidth(true);\">←宽→</a>";
		document.getElementsByTagName('body')[0].style.width = "768px";
		$('siteHead').style.width ="760px";
		//$('siteHead').style.left = ((window.screen.availWidth-document.getElementsByTagName('body')[0].offsetWidth)/2)+'px';

		return;	
	}
	//(document.documentElement.clientWidth >950) ? setWebIsWidth(true) :setWebIsWidth(false);	
	document.getElementsByTagName('body')[0].style.width= (document.documentElement.clientWidth >950) ? "900px" :"768px";	
	$('siteHead').style.width = (document.documentElement.clientWidth >950) ? "900px" :"768px";	

}

