//%%%%%%%%%%%%%%%%%%%%%%%%   M I S C  J A V A S C R I P T  F U N C T I O N S   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

//IWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIW ----  LOGIN TO COMMENT IN ARQ POP UP ---- 

function calltocmt(aarq){
	document.getElementById("tocmt").style.width="100%";
	document.getElementById("tocmt").style.height="100%";
	document.getElementById("tocmt").style.visibility="visible";

	document.getElementById("tocmt").innerHTML="<div class='cmtlgnbg'></div><div id='cmtlgn'><span class='cmtmsg'><b>Oops!<br>You have to login to post a comment.</b><a href='javascript:closetocmt();' id='cmtclose' title='close'>x</a></span><div style='border-top: 1px solid; text-align: center; margin-top: 45px; position: relative; width: 379px; padding-top: 8px;'><div style='float: left; margin-left: 25px;'><div class=buto style='float: left; margin-right: 20px;'><input type='button' value='Login' onclick=location.href='http://www.aarqee.com/aarqean/signin'></div><div class=buto style='float: left;'><input type='button' value='Not an Aarqean?' onclick=location.href='http://www.aarqee.com/aarqean/signup'></div></div></div></div>";

	document.getElementById("tocmt").style.top=document.documentElement.scrollTop+"px";
	window.onscroll=function(){
		document.getElementById("tocmt").style.top=document.documentElement.scrollTop+"px";
	}
}
function closetocmt(){
	document.getElementById("tocmt").innerHTML="";
	document.getElementById("tocmt").style.visibility="hidden";
}


//IWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIW ----  REGISTRATION HELP ---- 


function reg_selehelp(elmid,switchi){//----------border the help box

	if(elmid=="usrnbx"){//----------see which box to switch to
		tohighlight="hlpusna";
	}else if(elmid=="pswrdbx"){
		tohighlight="hlppass";
	}else if(elmid=="emewbx"){
		tohighlight="hlpeml";
	}else if(elmid=="valibx"){
		tohighlight="hlpval";
	}


	document.getElementById(tohighlight).style.border="1px solid #99deff";
	document.getElementById(tohighlight).getElementsByTagName('h3')[0].style.color="#fff";
}
function reg_unselehelp(elmid2){//----------unborder the help box
	if(elmid2=="usrnbx"){
		unhighlight="hlpusna";
	}else if(elmid2=="pswrdbx"){
		unhighlight="hlppass";
	}else if(elmid2=="emewbx"){
		unhighlight="hlpeml";
	}else if(elmid2=="valibx"){
		unhighlight="hlpval";
	}
	document.getElementById(unhighlight).style.border="1px solid #000";
	document.getElementById(tohighlight).getElementsByTagName('h3')[0].style.color="#646dc6";
}



//IWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWI ----  COVERED BUTTON CHANGER ---- 

function hov(butid,swt){//----------big 'create arq' size
	if(swt){
		document.getElementById(butid).style.background="url(http://www.aarqee.com/a/allpngs.png) -150px -257px no-repeat";
	}else{
		document.getElementById(butid).style.background="url(http://www.aarqee.com/a/allpngs.png) 0 -257px no-repeat";
	}	
}

//IWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIW ----  XMLHTTPREQUESTER ---- IWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIW


//-----------This is so not AJAI...

//-----------SUMMON AJAX AND YOU SUMMON ME...

function ajaxa(){
	if(window.XMLHttpRequest){
		xsync=new XMLHttpRequest();
	}else{
		xsync=new ActiveXObject("Microsoft.XMLHTTP");
	}
	return xsync;
}



//IWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWI ----  SUBCATEGORY LISTER ---- 

function disubcat(catid,scatn){

	//------------------------------------------------create an XMLHttpRequest instance
	xject=ajaxa();
	//------------------------------------------------prepare data to send
	scid="catid="+catid+"&scatn="+scatn;

	//------------------------------------------------Prepare to send data to server with open() and send with send()
	xject.open("POST","http://www.aarqee.com/ajaxprocessor/",true);

	//------------------------------------------------specify headers for post method
	xject.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xject.setRequestHeader("Content-length", scid.length);

	//------------------------------------------------get response duing onreadystatechange event
	xject.onreadystatechange=function(){
	//------------------------------------------------Ready to get response (request complete)
		if(xject.readyState==4){
			subcatlist=xject.responseText;
	//------------------------------------------------Return data to whoever's calling the function
			parent.document.getElementById('subcatabox').innerHTML=subcatlist;
			//parent.alert(subcatlist);
		}
	}

	xject.send(scid);
}

//IWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIW ----  SUBARQ LISTER ---- 

function disubarq(arqnin){

	//------------------------------------------------Setup the div to display the list of subarqs in parent

	//------------------------------------------------Open subarq list
	parent.document.getElementById(arqnin).style.display="block";
	parent.document.getElementById(arqnin).innerHTML="<span class='blatch'></span><div class='subsbxtit'><b>Child arqs</b></div><br><br><br><br><center><img src='http://www.aarqee.com/a/loading.gif'></center>";


	//------------------------------------------------Change '+' button to '-' button
	btnid=arqnin+"_btn";
	parent.document.getElementById(btnid).innerHTML="-";
	parent.document.getElementById(btnid).href="javascript:void(0)";
	parent.document.getElementById(btnid).style.border="1px solid #646dc6";

	//------------------------------------------------create an XMLHttpRequest instance
	xject=ajaxa();

	arqninpass="aq="+arqnin;

	//------------------------------------------------Prepare to send data to server with open() and send with send()
	xject.open("POST","http://www.aarqee.com/ajaxprocessor/",true);

	//------------------------------------------------specify headers for post method
	xject.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xject.setRequestHeader("Content-length", arqninpass.length);

	//------------------------------------------------get response duing onreadystatechange event
	xject.onreadystatechange=function(){
	//------------------------------------------------Ready to get response (request complete)
		if(xject.readyState==4){
			subarqlist=xject.responseText;
			parent.document.getElementById(arqnin).innerHTML="<span class='blatch'></span><div class='subsbxtit'><b>Child arqs</b></div><ul>"+subarqlist;
			parent.document.getElementById(btnid).href="javascript:closubarq('"+btnid+"','"+arqnin+"')";
			//parent.alert(subarqlist);
		}
	}

	xject.send(arqninpass);
}

//IWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIW ----  SUBARQ LISTER CLOSER  ---- 

function closubarq(arqninbtn,arqnin){

	//-------------------------------------------------Change '-' button to '+' button

	parent.document.getElementById(arqninbtn).innerHTML="+";
	parent.document.getElementById(arqninbtn).href="javascript:disubarq('"+arqnin+"')";
	parent.document.getElementById(arqninbtn).style.border="1px solid #000";


	//-------------------------------------------------close the subarq list box

	parent.document.getElementById(arqnin).innerHTML="";
	parent.document.getElementById(arqnin).style.display="none";

}

//IWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWI ----  AARQEAN LIBRARY TOPIC OPENER ---- 

function topen(topid,bxid){
	if(parent.document.getElementById(bxid)){
		parent.document.getElementById(bxid).style.display="inline";
		parent.document.getElementById(topid).href="javascript:topclos('"+topid+"','"+bxid+"')";
	//	parent.alert(parent.document.getElementById(topid).href);
	}
}

//IWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWI ----  AARQEAN LIBRARY TOPIC CLOSER ---- 

function topclos(topid,bxid){
	if(parent.document.getElementById(bxid)){
		parent.document.getElementById(bxid).style.display="none";
		parent.document.getElementById(topid).href="javascript:topen('"+topid+"','"+bxid+"')";
	//	parent.alert(parent.document.getElementById(topid).href);
	}
}

//IWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIW ----  AARQEAN LIBRARY OPEN TOPIC FROM (?) ---- 

function topner(tnum){
	for(tt=1; tt<=tnum.length; tt++){
		topen("t"+tnum.substring(0,tt),"box"+tnum.substring(0,tt));
	}
}


//>IWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWI ----  AARQEAN LIBRARY TITLE GLOW ----

function glower(opv,glid,blnk){
	r=opv;
	if(r>=-1){
		parent.document.getElementById(glid).style.opacity=r/10;
		parent.document.getElementById(glid).style.filter="alpha(opacity="+r*10+")";
		r-=0.5;
		if(blnk!=3){
			if(r==5){
				blnk++;
				opa=10;
			}else{
				opa=r;
			}
			setTimeout('glower('+opa+',"'+glid+'",'+blnk+')',Math.round(200/Math.round(r)));
		}else{
			if(r==0){
				parent.document.getElementById(glid).style.opacity="0";
				parent.document.getElementById(glid).style.filter="alpha(opacity=0)";
			}
			setTimeout('glower('+r+',"'+glid+'",'+blnk+')',Math.round(200/Math.round(r)));
		}
	}	
} 


//IWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWI ----  AARQEAN LIBRARY TOPPER ----

function totop(){
	/*document.getElementById("hetop").style.bottom="100px";
	document.getElementById("hesear").style.top="20px";*/
	window.onscroll=function(){
		document.getElementById("hetop").style.bottom=(100-document.documentElement.scrollTop)+"px";
		document.getElementById("hesear").style.top=(document.documentElement.scrollTop+20)+"px";
	}
}


//IWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWI ----  AARQEAN LIBRARY OPEN ALL ----

function openall(){
	for(d=0; d<wholehelp.length; d++){//------>---this is to turn things back to black
		topen("t"+wholehelp[d][0],"box"+wholehelp[d][0]);
	}
	parent.document.getElementById("hopcl").innerHTML="CLOSE<br>ALL";
	parent.document.getElementById("hopcl").style.padding="3px 3px 18px 3px";
	parent.document.getElementById("hopcl").href="javascript:closall()";

	q=parent.document.getElementById("heopalltip");
	q.innerHTML="/\\";
	q.style.marginTop="-18px";
	q.style.width="14px";
}

//>IWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWI ----  AARQEAN LIBRARY CLOSE ALL ----

function closall(){
	for(d=0; d<wholehelp.length; d++){//------>---this is to turn things back to black
		topclos("t"+wholehelp[d][0],"box"+wholehelp[d][0]);
	}
	parent.document.getElementById("hopcl").innerHTML="OPEN<br>ALL";
	parent.document.getElementById("hopcl").style.padding="3px";
	parent.document.getElementById("hopcl").href="javascript:openall()";

	p=parent.document.getElementById("heopalltip");
	p.innerHTML="v";
	p.style.marginTop="-7px";
	q.style.width="12px";
}

//>IWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIW ---- CHANGE UNFAVOR AND UNBUDDY IFRAME SOURCE ---- 


function changeunfavsrc(ifid,toworkon,whof,swich){
	switch(swich){
		case 1:
			parent.document.getElementById(ifid).src="http://www.aarqee.com/aas/iframesrcs.php?fncon=14&arqw="+toworkon+"&arqn="+whof;
			break;
		case 2:
			parent.document.getElementById(ifid).src="http://www.aarqee.com/aas/iframesrcs.php?fncon=4&arqn="+toworkon+"&varqn="+whof+"&fcp=1";
			break;
		case 3:
			parent.document.getElementById(ifid).src="http://www.aarqee.com/aas/iframesrcs.php?fncon=5&arqn="+toworkon+"&varqn="+whof+"&fcp=1";
			break;
	}
}

//IWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIW ---- DISPLAY ALL ARQS ---- 

function shollarqs(dispwhere,aarqean,ctg,odr,pgnum){

//?$?$?$?$?$?$?$?$?$?$?$?$?                              first part controls parent       $?$?$?$?$?$?$?$?$?$?$?$?$?$?$?$?

	parent.document.getElementById(dispwhere).innerHTML="<br><br><br><br><center><img src='http://www.aarqee.com/a/loading.gif' alt='loading'></center><br><br><br><br>";
	
	if(dispwhere.substr(0,7)=="sarqbox"){//-----------------check if this if for sarqbox
		suparqname=dispwhere.substring(7);//----------------if yes, get what's after sarqbox
	}else{
		suparqname="";
	}

	if(suparqname==""){
	
		if(odr=="adate"){//------------------------------------------------------------------------------------arq order
			//---------------------------------------------------select which thing to order by
			parent.document.getElementById("az").style.border="0px";
			parent.document.getElementById("dt").style.border="1px solid";
			parent.document.getElementById("vw").style.border="0px";
			parent.document.getElementById("rt").style.border="0px";
	
			//---------------------------------------------------shift slector
			parent.document.getElementById("slctr").style.marginLeft="56px";
	
		}else if(odr=="aviews"){
			//---------------------------------------------------select which thing to order by
			parent.document.getElementById("az").style.border="0px";
			parent.document.getElementById("dt").style.border="0px";
			parent.document.getElementById("vw").style.border="1px solid";
			parent.document.getElementById("rt").style.border="0px";
	
			//---------------------------------------------------shift slector
			parent.document.getElementById("slctr").style.marginLeft="111px";
	
		}else if(odr=="arate"){
			//---------------------------------------------------select which thing to order by
			parent.document.getElementById("az").style.border="0px";
			parent.document.getElementById("dt").style.border="0px";
			parent.document.getElementById("vw").style.border="0px";
			parent.document.getElementById("rt").style.border="1px solid";
	
			//---------------------------------------------------shift slector
			parent.document.getElementById("slctr").style.marginLeft="166px";
	
		}else if(odr=="" || odr==null){
	
			//---------------------------------------------------select which thing to order by
			parent.document.getElementById("az").style.border="1px solid";
			parent.document.getElementById("dt").style.border="0px";
			parent.document.getElementById("vw").style.border="0px";
			parent.document.getElementById("rt").style.border="0px";
	
			//---------------------------------------------------shift slector
			parent.document.getElementById("slctr").style.marginLeft="1px";
	
			odr="";
		}
	}else{

		//---------------------------------------------------open the box
		s=parent.document.getElementById(dispwhere).style;
		s.display="block";
		s.marginLeft="20px";
		s.marginBottom="10px";
		s.borderLeft="1px solid";
		s.borderBottom="1px solid";

		//---------------------------------------------------change the + to - and function
		b=parent.document.getElementById("dropbut"+suparqname);
		b.innerHTML="-";
		b.href="javascript:sarqclose('sarqbox"+suparqname+"','dropbut"+suparqname+"','"+aarqean+"')";
	}




//?$?$?$?$?$?$?$?$?$?$?$?$?$?$?$?$?                                     second part sends AJAX things     $?$?$?$?$?$?$?$?

	//------------------------------------------------create an XMLHttpRequest instance
	xject=ajaxa();

	//------------------------------------------------format things to send
	if(suparqname==""){
		disstyle="aarqean="+aarqean+"&ctg="+ctg+"&odr="+odr+"&pn="+pgnum;
	}else{
		disstyle="aarqean="+aarqean+"&odr="+odr+"&arq="+suparqname+"&pn="+pgnum;
	}

	//------------------------------------------------Prepare to send data to server with open() and send with send()
	xject.open("POST","http://www.aarqee.com/ajaxprocessor/",true);

	//------------------------------------------------specify headers for post method
	xject.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	//xject.setRequestHeader("Content-length", disstyle.length);

	//------------------------------------------------get response duing onreadystatechange event
	xject.onreadystatechange=function(){

	//------------------------------------------------Ready to get response (request complete)
		if(xject.readyState==4){
			thearqs=xject.responseText;
			parent.document.getElementById(dispwhere).innerHTML=thearqs;
		}
	}

	xject.send(disstyle);
}

//IWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWI ---- CHANGE ONCHANGE FUNCTION FOR SELECT LIST (ORDER BY DATE)---- 

function odrchange(arqnname,swch,swch2){
	parent.document.getElementById("ctgsel").onchange=function(){
		if(swch2==1){
			shollarqs("midall",arqnname,parent.document.getElementById("ctgsel").options[parent.document.getElementById("ctgsel").selectedIndex].value,swch,"");
		}else if(swch2==2){
			mangarq("midmng",arqnname,parent.document.getElementById("ctgsel").options[parent.document.getElementById("ctgsel").selectedIndex].value,swch,"");
		}
	}
}

//IWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIW ---- CHANGE BUTTON FUNCTION FOR SUBARQ LIST ---- 

function sarqclose(sid,sbid,aarqean){
	parent.document.getElementById(sid).innerHTML="";
	parent.document.getElementById(sid).style.display="none";

	//--------------------------------------------------change - to + and function
	parent.document.getElementById(sbid).innerHTML="+";
	parent.document.getElementById(sbid).href="javascript:shollarqs('"+sid+"','"+aarqean+"','','','')";
}

//IWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWI ---- DISPLAY ARQS IN MANAGE ARQS ---- 

function mangarq(dispwhere,arqon,ctg,odrm,pgnum){


	parent.document.getElementById(dispwhere).innerHTML="<br><br><br><br><center><img src='http://www.aarqee.com/a/loading.gif' alt='loading'></center><br><br><br><br>";

	if(odrm=="adate"){//------------------------------------------------------------------------------------arq order
		//---------------------------------------------------select which thing to order by
		parent.document.getElementById("az").style.border="0px";
		parent.document.getElementById("dt").style.border="1px solid";
	
		//---------------------------------------------------shift slector
		parent.document.getElementById("slctr").style.marginLeft="56px";

	}else if(odrm=="" || odrm==null){
	
		//---------------------------------------------------select which thing to order by
		parent.document.getElementById("az").style.border="1px solid";
		parent.document.getElementById("dt").style.border="0px";
	
		//---------------------------------------------------shift slector
		parent.document.getElementById("slctr").style.marginLeft="1px";
		odr="";
	}

	//------------------------------------------------create an XMLHttpRequest instance
	xject=ajaxa();

	//------------------------------------------------mng is switch. Nothing else
	dispo="arqon="+arqon+"&ctg="+ctg+"&odrm="+odrm+"&pn="+pgnum+"&mng=1";

	//------------------------------------------------Prepare to send data to server with open() and send with send()
	xject.open("POST","http://www.aarqee.com/ajaxprocessor/",true);

	//------------------------------------------------specify headers for post method
	xject.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	//xject.setRequestHeader("Content-length", dispo.length);

	//------------------------------------------------get response duing onreadystatechange event
	xject.onreadystatechange=function(){

	//------------------------------------------------Ready to get response (request complete)
		if(xject.readyState==4){
			thearqs=xject.responseText;
			parent.document.getElementById(dispwhere).innerHTML=thearqs;
		}
	}

	xject.send(dispo);
}

//IWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWI ---- ARQ STATUS ---- 

function disarqstat(dispwhere){
	
	r=parent.document.getElementById(dispwhere);
	r.style.display="block";
	r.style.margin="0px 2px 2px 0px";
	r.style.padding="4px 4px 4px 4px";
	r.innerHTML="<br><br><center><img src='http://www.aarqee.com/a/loading.gif' alt='loading'></center><br><br>";

	//------------------------------------------------create an XMLHttpRequest instance
	xject=ajaxa();

	//------------------------------------------------mng is switch. Nothing else
	dispstat="arq="+dispwhere+"&ast=1";

	//------------------------------------------------Prepare to send data to server with open() and send with send()
	xject.open("POST","http://www.aarqee.com/ajaxprocessor/",true);

	//------------------------------------------------specify headers for post method
	xject.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	//xject.setRequestHeader("Content-length", dispstat.length);

	//------------------------------------------------get response duing onreadystatechange event
	xject.onreadystatechange=function(){

	//------------------------------------------------Ready to get response (request complete)
		if(xject.readyState==4){
			thearqs=xject.responseText;
			r.innerHTML=thearqs;
		}
	}

	xject.send(dispstat);
}

//IWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWI ---- FLIP FAN LIST PAGE ----

function fanflip(fdis,pgnum){

	f=parent.document.getElementById(fdis);
	f.innerHTML="<br><br><br><center><img src='http://www.aarqee.com/a/loading.gif' alt='loading'></center><br><br><br><br><br>";

	//------------------------------------------------create an XMLHttpRequest instance
	xject=ajaxa();

	//------------------------------------------------mng is switch. Nothing else
	dispfan="fdw="+fdis+"&fnn=1&fpn="+pgnum;

	//------------------------------------------------Prepare to send data to server with open() and send with send()
	xject.open("POST","http://www.aarqee.com/ajaxprocessor/",true);

	//------------------------------------------------specify headers for post method
	xject.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xject.setRequestHeader("Content-length", dispfan.length);

	//------------------------------------------------get response duing onreadystatechange event
	xject.onreadystatechange=function(){

	//------------------------------------------------Ready to get response (request complete)
		if(xject.readyState==4){
			thefans=xject.responseText;
			f.innerHTML=thefans;
		}
	}

	xject.send(dispfan);
	
}

//IWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWI ---- CLOSE ARQ STATUS ---- 

function closearqstats(clo){
	w=parent.document.getElementById(clo);
	w.style.display="none";
}


//IWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWI ---- LOGGER INNER OUTER----

function loggerio(swc,rfrsh){

	//------------------------------------------------create an XMLHttpRequest instance
	xject=ajaxa();

	//----------------------------memorizes the contents of the form for later use
	loggerf=document.getElementById("logfrm").innerHTML;

	if(swc){
		usrn=document.getElementById("usna").value;
		pswa=document.getElementById("paswo").value;
		rmbc=document.getElementById("reme").checked;//---------rmbc will contain "true" or "false"
		rmb=0;
		if(rmbc==true){
			rmb=1;
		}

		document.getElementById("logfrm").innerHTML="<br>SIGNING IN...";

		lstuff="usna="+usrn+"&paswo="+pswa+"&reme="+rmb;

	}else{
		document.getElementById("logfrm").innerHTML="<br>SIGNING OUT...";

		lstuff="loio=1";
	}

	//------------------------------------------------Prepare to send data to server with open() and send with send()
	xject.open("POST","http://www.aarqee.com/ajaxprocessor/",true);

	//------------------------------------------------specify headers for post method
	xject.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xject.setRequestHeader("Content-length", lstuff.length);

	//------------------------------------------------get response duing onreadystatechange event
	xject.onreadystatechange=function(){

	//------------------------------------------------Ready to get response (request complete)
		if(xject.readyState==4){
			l=document.getElementById("logfrm");
			logstats=xject.responseText;

			if(swc){
				if(logstats=="logged"){
					displog(rfrsh);//-------display stuff after login
					if(rfrsh){
						//--------------------refresh page to simulate usual signout.  Applies for profiles and arqs only.
						refreshener();
					}
				}else{
					l.innerHTML=loggerf;
					document.getElementById("logemes").innerHTML=logstats;
				}
			}else{
				if(logstats=="logged out"){
					//---------------------------------The last person to logout will be usrpg for the login form
					//---------------------------------That doesn't really matter for login because usrpg is just to
					//---------------------------------Bring the data from page to js function to fill in this function's
					//---------------------------------usrpg parameter
					l.innerHTML="<div id='logfrm'><div id='logemes'></div><label for='usna' class=loglab>Username:</label><input type='text' name='usna' id='usna' size=12 class='logintbx tebo'><label for='paswo' class=loglab>Password:</label><input type='password' name='paswo' id='paswo' size=12 class='logintbx tebo'><input type='checkbox' name='reme' id='reme'><label for='reme' class=loglab>Remember Me</label><div id=logb class=loginbtn><input type='button' onclick=loggerio(1,"+rfrsh+") value='Sign in'></div><br class='fbreaker'><div><a href='http://www.aarqee.com/aarqean/signup'>Not an Aarqean? REGISTER!</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='http://www.aarqee.com/aarqean/retrieve'>Forgot Login?</a></div></div>";
					if(rfrsh){
						//--------------------refresh page to simulate usual signout.  Applies for profiles and arqs only.
						refreshener();
					}
				}else{
					l.innerHTML=loggerf;
					document.getElementById("logemes").innerHTML=logstats;
				}
			}
		}
	}

	xject.send(lstuff);
	
} 

//IWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWI ---- DISPLAY STUFF AFTER LOGIN----

function displog(rfrsh){
	//------------------------------------------------create an XMLHttpRequest instance
	xject=ajaxa();

	dl="dl=1&rfrsh="+rfrsh;

	//------------------------------------------------Prepare to send data to server with open() and send with send()
	xject.open("POST","http://www.aarqee.com/ajaxprocessor/",true);

	//------------------------------------------------specify headers for post method
	xject.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xject.setRequestHeader("Content-length", dl.length);

	//------------------------------------------------get response duing onreadystatechange event
	xject.onreadystatechange=function(){

	//------------------------------------------------Ready to get response (request complete)
		if(xject.readyState==4){
			loggd=xject.responseText;
			la=document.getElementById("logfrm");
			la.innerHTML=loggd;
		}
	}

	xject.send(dl);

}

//IWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWI ---- REFRESHER ----

function refreshener(){
	window.location.href=window.location.href;
}


//IWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWI ---- RATING BAR MESSAGE ----

function rbarchange(valu){
	switch(valu){
		case 1:
			document.getElementById("ratebar").style.background="url(http://www.aarqee.com/a/ratingbar.png) 0px -150px no-repeat";
			document.getElementById("ratetext").innerHTML="BAD!<br>This arq is not interesting at all!";
			break;
		case 2:
			document.getElementById("ratebar").style.background="url(http://www.aarqee.com/a/ratingbar.png) 0px -120px no-repeat";
			document.getElementById("ratetext").innerHTML="Not bad.<br>Still needs a lot of improvement.";
			break;
		case 3:
			document.getElementById("ratebar").style.background="url(http://www.aarqee.com/a/ratingbar.png) 0px -90px no-repeat";
			document.getElementById("ratetext").innerHTML="Ok.<br>Not too bad, not too good.";
			break;
		case 4:
			document.getElementById("ratebar").style.background="url(http://www.aarqee.com/a/ratingbar.png) 0px -60px no-repeat";
			document.getElementById("ratetext").innerHTML="Pretty good!<br> Keep up the good arqwork.";
			break;
		case 5:
			document.getElementById("ratebar").style.background="url(http://www.aarqee.com/a/ratingbar.png) 0px -30px no-repeat";
			document.getElementById("ratetext").innerHTML="AWESOME!<br>This is the best arq ever!";
			break;
		default:
			document.getElementById("ratebar").style.background="none";
			document.getElementById("ratetext").innerHTML="Slide your cursor across the bar below and click a dot to rate.";
			break;
	}
}


//IWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIW ---- CLOSE QUICK MESSAGE BOX ----

function closeqm(){
	document.getElementById("stretched").style.width="0";
	document.getElementById("stretched").style.height="0";
	document.getElementById("stretched").style.visibility="hidden";

	document.getElementById("qmbox").style.width="0";
	document.getElementById("qmbox").style.height="0";
	document.getElementById("qmbox").style.visibility="hidden";

	document.getElementById("qmtitle").style.width="0px";
	document.getElementById("qmtitle").style.visibility="hidden";

	document.getElementById("qmclos").style.visibility="hidden";
}


//IWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIW ---- CALCULATE TIME DURING ARQ CREATING ----

function calda(){

	//-----------------------------get client's timezone
	//-----------------------------it's actually the number of hours to the East or West of GMT

	d=new Date();
	zohn=-d.getTimezoneOffset()/60;//-----------returns minutes so have to divide by 60


	if(zohn<=23 && zohn>=-23){//>-------------------------------------implausible timezone

		//------------------------------------------------create an XMLHttpRequest instance
		xject=ajaxa();
	
		tz="tazo="+zohn;
	
		//------------------------------------------------Prepare to send data to server with open() and send with send()
		xject.open("POST","http://www.aarqee.com/ajaxprocessor/",true);
	
		//------------------------------------------------specify headers for post method
		xject.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xject.setRequestHeader("Content-length", tz.length);
	
	/*	//------------------------------------------------no need to get response duing onreadystatechange event
		//------------------------------------------------because nothing is going to be displayed	
		//------------------------------------------------this is for testing
		xject.onreadystatechange=function(){
			if(xject.readyState==4){
				sometime=xject.responseText;
				//alert(sometime);
			}
		}*/
	
		xject.send(tz);
	}
}


//IWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWI ---- OPEN INTRO VIDEO ----

function intrvd(){
	iv=document.getElementById("introv");
	iv.style.height="90%";
	iv.style.width="90%";
	iv.style.visibility="visible";

	iv.innerHTML="<div id='introbg'></div><div><a href=javascript:cintrvd(iv); class='closintro'>&nbsp;x&nbsp;</a><br><embed src='http://www.aarqee.com/a/intro/aarqeeintro.swf' menu='false' quality='high' bgcolor='#ffffff' width='500' height='281' name='aarqeeintro' align='middle' allowScriptAccess='sameDomain' allowFullScreen='false' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></div>";
}

//IWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWIWI ---- CLOSE INTRO VIDEO ----

function cintrvd(iv){
	iv.innerHTML="";
	iv.style.visibility='hidden';
}



