// JavaScript Document
function clickTOShow(id1,id2)
{
	var effect=id1+"selected"
	var tabid1=id1+"tab"
	var normal=id2+"normal"	
	var tabid2=id2+"tab"
	document.getElementById(id1).style.display="";
	document.getElementById(id2).style.display="none";	
	document.getElementById(tabid1).className=effect;
	document.getElementById(tabid2).className=normal;
}


function setPageDynamicTabStyle(id,basepath,tabid1,tabid2)
{
	setSelectedAttribute(id,basepath);  /*category search page tabs*/
	clickTOShow(tabid1,tabid2);         /*left side category ,country tabs*/
}


function setDisplay(id,records)
{
  for(i=1;i<=records;i++)
  {
    if(i==id)
    {
      document.getElementById('tab0'+i).style.display="";
      document.getElementById('idtab0'+i).className="current"; 	 
    }
    else
    {
      document.getElementById('tab0'+i).style.display="none";
      document.getElementById('idtab0'+i).className="";		
    }
  }	 	 	 
}


function setSelected(ref)
{	
	if(document.getElementById(ref))
 document.getElementById(ref).className="leftlinksactive"; 
}

function setActiveTab(id1,id2,active)
{
	clickTOShow(id1,id2);
	document.getElementById(active).className="leftlinksactive"; 
}


function invokeSearch()
{
			if(document.getElementById('searchkeyword').value!="" && document.getElementById('searchkeyword').value!="Search Article")
			{ 
				 var searchstr=trimSpaces(document.getElementById('searchkeyword').value);				 
				 document.form_search.submit();
			}
			else
			return false;	 
}


function invokeAdvCategory(category)
{
 	document.getElementById('cateid').value=category;
  document.form_advcat.submit();
}



function setVisited(id1,id2,effect,normal) //for compare select
{
	var tabid1=id1+"tab"	
	var tabid2=id2+"tab"
	document.getElementById(id1).style.display="";
	document.getElementById(id2).style.display="none";	
	document.getElementById(tabid1).className=effect;
	document.getElementById(tabid2).className=normal;
}


function loadAppliedTab(tabname)
{
   if(tabname=='Stab')
   {
     setVisited('rfilter','lfilter','ctryselected','catnormal');
   }
   else
   {
     setVisited('lfilter','rfilter','catselected','ctrynormal');
   }
}


function setSelectedAttribute1(id,displayname,subcategory,basepath)
{   
	   var splitted =new Array();
	   var loopval=document.getElementById('tabids').value;
			 splitted =loopval.split(",");	
		 							
			 for (var i=0;i<splitted.length;i++) 
			 {
			 	 var item=splitted[i];
			 	 var ref = 'idl_'+item;
			 	 if(id==item)
			 	  document.getElementById(ref).className="leftlinksactive";
			 	 else
			 	 {
			 	 	document.getElementById(ref).className="";
			 	 }
			 }
			 document.getElementById('fronttab').innerHTML=displayname;
			 document.getElementById('fronttab').className="catselected";
			 document.getElementById('reartab').className="ctrynormal";
			 showAttributes(id,subcategory,basepath); 			 			 
}




function loadSelectedAttribute(id,displayname)
{   
   	var ref = 'idl_'+id;
   	if(document.getElementById(ref))
    document.getElementById(ref).className="leftlinksactive";
			 document.getElementById('fronttab').innerHTML=displayname;
			 document.getElementById('fronttab').className="catselected";
			 document.getElementById('reartab').className="ctrynormal";
			  			 
}



function setSelectedNavlink(navid)
{
			var navlink = 'atr_'+navid;
			var splitted =new Array();
			var flager =0;
		 var loopval=document.getElementById('frontids').value;
		 splitted =loopval.split(",");	
									
		 for (var i=0;i<splitted.length;i++) 
		 {
		 	 var item=splitted[i];		 	 
		 	 if(navid==item)
		 	 flager =1 		 	 
		 }
		 if(flager==0)
		 {
		 	 document.getElementById('front').style.display ="none";
    	document.getElementById('rear').style.display  ="";	
		 	 document.getElementById('fronttab').className  ="catnormal";
			  document.getElementById('reartab').className   ="ctryselected";
		 }
			document.getElementById(navlink).className="leftlinksactive";	
}

	


function valSignupBox() //for left menu box
{
	 if(document.form_signupbox.subemail.value!='' && document.form_signupbox.subemail.value!='Email Address')
	 {
			 if(!checkEmail(eval("document.form_signupbox.subemail.value")))
			 {
				 	document.form_signupbox.subemail.value="";
				  eval("document.form_signupbox.subemail.focus()");
				  return false;
			 }
			 else
			 {
			   document.form_signupbox.submit();
			 }
	 }
	 else
	 {
	   document.form_signupbox.submit();
	 }
}

	
function validateComment(fldaction)
{
  if(fldaction=='N')
  {
     alert("Comments closed for this site");
     return false;
  }
  else if(fldaction=='I')
  {
     alert("Comments cannot be submitted for an inactive site");
     return false;
  }
  else
  {
   	 var field_name  = new Array("author","gender","email","country","comment","securecode");
   		var display_name= new Array("Name","Gender","Email","Country","Comment","Secure Code");
   		var count_array = 6;
   		
   		if(check_fields('commentform',field_name,display_name,count_array))
   		{
    		 document.commentform.author.value      = trimSpaces(document.commentform.author.value);
    		 document.commentform.email.value       = trimSpaces(document.commentform.email.value);
    		 
    		 if(!checkEmail(eval("document.commentform.email.value")))
    		 {
   	 	  eval("document.commentform.email.focus()");
   			  return false;
    		 } 
    		 if(document.commentform.rateval.value>0){}
    		 else
    		 {
    		 	alert('Click the stars icon to rate the site. A rating must be provided')
    		 	return false;
    		 }
    		 var comment=trimSpaces(document.commentform.comment.value);
    		 if(comment.length<50)
    		 {
    		 	alert('Comment should have minimum 50 chars');
    		 	return false;
    		 }
    		 document.commentform.submit();
   		}	    		
   		else
   		{
   		  return false; 
   		}
  }
}




function validateArticleComment()
{
	 var field_name  = new Array("author","gender","email","country","comment","securecode");
		var display_name= new Array("Name","Gender","Email","Country","Comment","Secure Code");
		var count_array = 6;
		
		if(check_fields('commentform',field_name,display_name,count_array))
		{
 		 document.commentform.author.value      = trimSpaces(document.commentform.author.value);
 		 document.commentform.email.value       = trimSpaces(document.commentform.email.value);
 		 
 		 if(!checkEmail(eval("document.commentform.email.value")))
 		 {
	 	  eval("document.commentform.email.focus()");
			  return false;
 		 }
 		 var comment=trimSpaces(document.commentform.comment.value);
 		 if(comment.length<50)
 		 {
 		 	alert('Comment should have minimum 50 chars');
 		 	return false;
 		 }  		 	 			 
 		 
		}	 
		
		else
		{
		  return false; 
		}
}


function replyComment(author, commentId, commentBox)
{
	var insertStr = '<a href="#' + commentId + '">@' + author.replace(/\t|\n/g, "") + '</a> \n';
	
	appendComReply(insertStr, commentBox);
}

function quoteComment(author, commentId, commentBodyId, commentBox) 
{
	var comment = document.getElementById(commentBodyId).innerHTML;

	var insertStr = '<blockquote cite="#' + commentBodyId + '">';
	insertStr += '\n<strong><a href="#' + commentId + '">' + author.replace(/\t|\n/g, "") + '</a> :</strong>';
	insertStr += comment.replace(/\t|\n/g, "");
	insertStr += '</blockquote>\n';

	insertComQuote(insertStr, commentBox);
}





function appendComReply(insertStr, commentBox) {
	if(document.getElementById(commentBox) && document.getElementById(commentBox).type == 'textarea') {
		field = document.getElementById(commentBox);

	} else {
		alert("The comment box does not exist!");
		return false;
	}

	if (field.value.indexOf(insertStr) > -1) {
		alert("You've already appended this reply!");
		return false;
	}

	if (field.value.replace(/\s|\t|\n/g, "") == '') {
		field.value = insertStr;
	} else {
		field.value = field.value.replace(/[\n]*$/g, "") + '\n\n' + insertStr;
	}
	field.focus();
}



function insertComQuote(insertStr, commentBox) {
	if(document.getElementById(commentBox) && document.getElementById(commentBox).type == 'textarea') {
		field = document.getElementById(commentBox);

	} else {
		alert("The comment box does not exist!");
		return false;
	}

	if(document.selection) {
		field.focus();
		sel = document.selection.createRange();
		sel.text = insertStr;
		field.focus();

	} else if (field.selectionStart || field.selectionStart == '0') {
		var startPos = field.selectionStart;
		var endPos = field.selectionEnd;
		var cursorPos = startPos;
		field.value = field.value.substring(0, startPos)
					  + insertStr
					  + field.value.substring(endPos, field.value.length);
		cursorPos += insertStr.length;
		field.focus();
		field.selectionStart = cursorPos;
		field.selectionEnd = cursorPos;

	} else {
		field.value += insertStr;
		field.focus();
	}
}


function textLimit(field, maxlen) 
{
		if (field.value.length > maxlen + 1)
		alert('Your input has been truncated.\nYou can only enter a maximum of 2500 chars');
		if (field.value.length > maxlen)
		field.value = field.value.substring(0, maxlen);
}

  

function rateSite()
{
 
  if(document.getElementById('rateval').value > 0)
  {
    document.getElementById('ratingSaved').style.display='block';
    document.getElementById('ratingSaved').innerHTML="Rating Saved";
  }
  else
  {
    document.getElementById('ratingSaved').style.display='block';
    document.getElementById('ratingSaved').innerHTML="Please Select";
  }

}





function compareSites(basepath,itemstate)
{	
    if(itemstate=='OFF')
    {
       alert("Inactive sites cannot be compared.");
    		 return false;		
    }
    else
    {
    	   if(document.getElementById('chkdval').value!='')
    	   {
    				   var splitted =new Array();				
    						 var loopval=document.getElementById('chkdval').value;
    						 splitted =loopval.split(",");	
    				   if(splitted.length>1)
    						 {
    						 	 var sites=document.getElementById('urlstring').value;	 
    						   window.location=basepath+"Compare/"+sites+"/";
    						  
    						 }
    							else
    							{
    					  		alert("More than One Sites Should be Selected to Compare");
    					  		return false;												
    					  }
    	   }
    	   else
    	   {
    	   	  alert("No Sites Selected.");
    						 return false;												
    	   }
    }
}





function checkSelected(checkbox,basepath,pageid,divid,selrow)
{
	   var chkdval,maxcompare,count,rowclass;
	   chkdval    = document.getElementById('chkdval').value;	   
	   maxcompare = document.getElementById('maxcompare').value;	   
	   rowclass   = selrow;   
	   count      = chkdval.split(',');
	   
	   if(checkbox.checked==true)
	   {	   	
					   if(count.length!=maxcompare)
					   {
				   	    if(chkdval!='')
				   	    				chkdval = chkdval + ',';
				   	    chkdval = chkdval + checkbox.value;
				   	    rowclass='comparelist_yellowrow';
					   }
					   else
					   {
					   	   checkbox.checked = false;
					   	   alert('You Can Compare Maximum '+maxcompare+' Site(s)');
					   }
					   
	   }
	   else
	   {
	   	   chkdval = '';
	   	   for (i = 0;i<count.length;i++) 
					  	{
					  					if(count[i]!=checkbox.value)
					  					{
									  		   if(chkdval!='')
								   	    				chkdval = chkdval + ',';
								   	    chkdval = chkdval + count[i];
					  					}
					  	}
	   }
	   document.getElementById('row_'+divid).className=rowclass;
	   document.getElementById('chkdval').value = chkdval;
	   rememberSite(chkdval,basepath,pageid);
}




function setRowClass(divid,rowclass)
{
 if(document.getElementById('checkList_'+divid))
 {
	  if(document.getElementById('checkList_'+divid).checked==false)
	  document.getElementById('row_'+divid).className=rowclass;
 }
}



function loadSelRowClass()
{
    if(document.getElementById('sellist'))
    {
       var chkdval    = document.getElementById('sellist').value;	   	    
      
   	   if(chkdval!='')
   	   {
   				   var count      = chkdval.split("\,");
   				   
   				   for (i = 0;i<count.length;i++) 
   				  	{
   				  					if(document.getElementById('checkList_'+count[i]).checked==true)
   				  					{
   								  		 document.getElementById('row_'+count[i]).className='comparelist_yellowrow';  
   				  					}
   				  	}
   	   }
    }
}







function setSelectedAttribute(id,basepath)
{   
	   var splitted =new Array();
	   var loopval=document.getElementById('tabids').value;
			 splitted =loopval.split(",");	
		 							
			 for (var i=0;i<splitted.length;i++) 
			 {
			 	 var item=splitted[i];
			 	 var ref = 'id_'+item;
			 	 if(id==item)
			 	  document.getElementById(ref).className="current";
			 	 else
			 	 {
			 	 	document.getElementById(ref).className="";
			 	 }
			 }
			 showAttributes(id,basepath); 
}





function alphaNumSearch(alphanum,basepath)
{			
		var searchvalue = document.getElementById('hidget').value;								
		var splitvalue  = searchvalue.split("&alpha=");		
		var qrystr      = splitvalue[0].split("alpha=");	
		
		window.location = basepath+"a-z/"+alphanum+"/";  // window.location = basepath+"user/a_z.php?"+qrystr[0]+"&alpha="+alphanum
}




function setSelectedTopLevel(id,displayname,basepath)
{   
    var subtitle=displayname;
	   var splitted =new Array();
	   var loopval=document.getElementById('tabids').value;
			 splitted =loopval.split(",");	
		 							
			 for (var i=0;i<splitted.length;i++) 
			 {
			 	 var item=splitted[i];
			 	 var ref = 'idtop_'+item;
			 	 if(id==item)
			 	  document.getElementById(ref).className="leftlinksactive";
			 	 else
			 	 {
			 	 	document.getElementById(ref).className="";
			 	 }
			 }
			 
			 if(displayname.length>12)
			 {
			   subtitle = displayname.substr(0,12)+"&hellip;"
			 }
			 document.getElementById('subtab').innerHTML=subtitle;
			 document.getElementById('subtab').title=displayname;
			 document.getElementById('subtab').className="catselected";
			 document.getElementById('submoretab').className="ctrynormal";
			 showSubLevel(id,basepath); 			 			 
}

function loadSelectedTopLevel(id,displayname)
{   
    var ref = 'idtop_'+id;
   	if(document.getElementById(ref))
    document.getElementById(ref).className="leftlinksactive";
    if(displayname)
    {
      var subtitle=displayname;
     	if(displayname.length>12)
  			 {
  			   subtitle = displayname.substr(0,12)+"&hellip;"
  			 }
    }
   	
    if(document.getElementById('subtab'))
    {
     document.getElementById('subtab').innerHTML=subtitle;
 			 document.getElementById('subtab').title=displayname;
 			 document.getElementById('subtab').className="catselected";
 			 document.getElementById('submoretab').className="ctrynormal";
    }
			  			 
}

function setSelectedSublevel(navid)
{
  	var navlink = 'subl_'+navid;
			var splitted =new Array();
			var flager =0;
		 var loopval=document.getElementById('frontids').value;
		 splitted =loopval.split(",");	
									
		 for (var i=0;i<splitted.length;i++) 
		 {
		 	 var item=splitted[i];		 	 
		 	 if(navid==item)
		 	 flager =1 		 	 
		 }
		 if(flager==0)
		 {
		 	 document.getElementById('sub').style.display ="none";
    	document.getElementById('submore').style.display  ="";	
		 	 document.getElementById('subtab').className  ="catnormal";
			  document.getElementById('submoretab').className   ="ctryselected";
		 }
			document.getElementById(navlink).className="leftlinksactive";	
}

function setSelectedHeader(headerid)
{
 var headerlink ='lid_'+headerid;
 if(document.getElementById(headerlink))			 
			 document.getElementById(headerlink).className="current"; 		
}


function customView(path,sites)
{		
	 window.open(path+"user/comparison_items.php?sites="+sites,"comparisonitems","menubar=0,scrollbars=1,resizable=0,width=750,height=640,top=10,left=150");
}

function viewGlossary(path)
{		
	 window.open(path+"user/view_glossary.php","Glossary","menubar=0,scrollbars=1,resizable=0,width=480,height=540,top=10,left=150");
}

function viewGuidelines(path)
{		
	 window.open(path+"user/view_guidelines.php","Guidelines","menubar=0,scrollbars=1,resizable=0,width=480,height=540,top=10,left=150");
}

function viewNewsletterHelp(path)
{		
	 window.open(path+"user/newsletter_help.php","Newsletter-Help","menubar=0,scrollbars=1,resizable=0,width=480,height=540,top=10,left=150");
}

function viewFeedsHelp(path,pagemap)
{		
	 window.open(path+"user/feeds_help.php#"+pagemap,"Feeds-Help","menubar=0,scrollbars=1,resizable=0,width=480,height=540,top=10,left=150");
}


function getTopSearchOption()
{
		if(document.form_topsearch.searchtitle)
		{
			 return document.form_topsearch.searchtitle.value;
		}
}
	
	
	
	function invokeTopPanelSearch_old(baseurl)//not in use
	{
		 if(document.form_topsearch.searchkeyword.value=='' || document.form_topsearch.searchkeyword.value=='Search')
		 {
		 	 alert('Please enter search keyword');
		 	 return false;
		 }
		 else
		 { 		     
		      var keyword = document.getElementById('searchbox').value;
		      
		      keyword = keyword.replace(/\s+/g,"+");
		      
   		 	 if(getTopSearchOption()=='S')
   		 	 {
   					  document.form_topsearch.action = baseurl+"search?query="+keyword+"&category=dating-sites";
   				   document.form_topsearch.submit();	
   		 	 }
   		 	 else if(getTopSearchOption()=='A')
   		 	 {
   		 	 	 document.form_topsearch.action = baseurl+"search?query="+keyword+"&category=dating-advice";
   				   document.form_topsearch.submit();	
   		 	 }
   		 	 else if(getTopSearchOption()=='B')
   		 	 {
   		 	 	 document.form_topsearch.action = baseurl+"blog/search?query="+keyword+"&category=blog";
   				   document.form_topsearch.submit();	
   		 	 }
   		 	 else if(getTopSearchOption()=='T')
   		 	 {
   		 	 	 document.form_topsearch.action = baseurl+"search?query="+keyword;
   				   document.form_topsearch.submit();	
   		 	 }
   		 	 else if(getTopSearchOption()=='O')
   		 	 {
   		 	 	 document.form_topsearch.action = baseurl+"search?query="+keyword+"&category=overviews";
   				   document.form_topsearch.submit();	
   		 	 }
   		 	 else if(getTopSearchOption()=='C')
   		 	 {
   		 	 	 document.form_topsearch.action = baseurl+"search?query="+keyword+"&category=compare_sites";
   				   document.form_topsearch.submit();	
   		 	 }			 	
		 }
	}
	
	
	function setQuickSearchAction(frmaction,baseurl)
	{    
	     var redirect;
	     var qboxd1 = document.form_quickbox.iam.value;
	     var qboxd2 = document.form_quickbox.seeking.value;
	     var qboxd3 = document.form_quickbox.regions.value;
	     if(document.form_quickbox.quenid.value==8)
	     {
	       qboxd4 = document.form_quickbox.religion.value;
	     }
	     else if(document.form_quickbox.quenid.value==10)
	     {
	       qboxd4 = document.form_quickbox.ethnic.value;
	     }
	     else
	     {
	       qboxd4 = document.form_quickbox.answerlist.value;
	     }
	     if(frmaction=="C")
  		  {
  		    redirect = "search/Custom/";
  		  }
  		  else if(frmaction=="G")
  		  {
  		  	 redirect =  "search/Custom/Results/";  		  	 
  		  }	 
  		      
	     setQboxValues(baseurl,redirect,qboxd1,qboxd2,qboxd3,qboxd4)	       		    
	}
	
	
	
	
function side_trimSpaces(stringValue) 
{
	   // Checks the first occurance of spaces and removes them
	   for(i = 0; i < stringValue.length; i++) 
	   {
		    if(stringValue.charAt(i) != " ") 
		     {			break;		}
	   }
	
	   if(i > 0) 
	   {		stringValue = stringValue.substring(i);	}
	
	   // Checks the last occurance of spaces and removes them
	   strLength = stringValue.length - 1;
	   for(i = strLength; i >= 0; i--) 
	   {
		   if(stringValue.charAt(i) != " ") 
		   {		break;		}
	   }
	
	   if(i < strLength) 
	   {		stringValue = stringValue.substring(0, i + 1);	}
	
	   // Returns the string after removing leading and trailing spaces.
	return stringValue;
}

//*FOR GoogleCE*/
function doAnySearch(formaction,keyword)
  {
    document.form_results.searchkeyword.value =keyword;
    document.form_results.action =formaction;
  		document.form_results.submit();	
  }
  function doRefineSearch(formaction)
  {
    document.form_results.action =formaction;
  		document.form_results.submit();	
  }  
  function doSuggestion(formaction,keyword)
  {
    if(document.form_results.searchtitle)
    {
     document.form_results.searchtitle.disabled=true;
    }
    document.form_results.searchkeyword.value =keyword;
    document.form_results.action =formaction;
  		document.form_results.submit();	
  }
//*FOR GoogleCE*/ 




var xmlHttp_global	

function setLeftTabOn(id1,id2,selectedid,path)
{
	 var url=path+"user/save_lefttab_value.php?id1="+id1+"&id2="+id2+"&selected="+selectedid;

		xmlHttp_global=GetXmlHttpObjectGlobal(saveTab)
		xmlHttp_global.open("GET", url , true)
		xmlHttp_global.send(null)
}

function destroyActiveTab(path)
{
	 var url=path+"user/destroy_lefttab_value.php";

		xmlHttp_global=GetXmlHttpObjectGlobal(unregisterValues)
		xmlHttp_global.open("GET", url , true)
		xmlHttp_global.send(null)	
}


var navlink;
function destroyPageGlobals(path,aid)
{ 
  navlink = aid;
  var url=path+"user/destroy_session_values.php";

		xmlHttp_global=GetXmlHttpObjectGlobal(unregisterValues)
		xmlHttp_global.open("GET", url , true)
		xmlHttp_global.send(null)
	
} 
	
	
function unregisterValues() 
{ 
		if (xmlHttp_global.readyState==4 || xmlHttp_global.readyState=="complete")
		{ 	
		  window.location=navlink.href;
		} 
}


function saveTab() 
{ 
		if (xmlHttp_global.readyState==4 || xmlHttp_global.readyState=="complete")
		{ 				  		 			
		} 
}


var redirect;
function setQboxValues(path,formaction,qboxd1,qboxd2,qboxd3,qboxd4)
{ 
  redirect = formaction
  var url=path+"user/save_qbox_search.php?qboxd1="+qboxd1+"&qboxd2="+qboxd2+"&qboxd3="+qboxd3+"&qboxd4="+qboxd4;

		xmlHttp_global=GetXmlHttpObjectGlobal(saveQboxSearch)
		xmlHttp_global.open("GET", url , true)
		xmlHttp_global.send(null)
	
} 
	
	
function saveQboxSearch() 
{ 
		if (xmlHttp_global.readyState==4 || xmlHttp_global.readyState=="complete")
		{ 	
		  document.form_quickbox.action =redirect;
  		document.form_quickbox.submit();	
		} 
}

var linktag
function replyThis(path,author,commentID,pagenavi)
{
  linktag=pagenavi;
  var url=path+"user/save_comment_info.php?author="+author+"&comid="+commentID+"&mode=R";

		xmlHttp_global=GetXmlHttpObjectGlobal(saveCommentInfo)
		xmlHttp_global.open("GET", url , true)
		xmlHttp_global.send(null)
 
}



function quoteThis(path,author,commentID,commentBodyId,pagenavi)
{
  linktag=pagenavi;
  var url=path+"user/save_comment_info.php?author="+author+"&comid="+commentID+"&commentbody="+commentBodyId+"&mode=Q";

		xmlHttp_global=GetXmlHttpObjectGlobal(saveCommentInfo)
		xmlHttp_global.open("GET", url , true)
		xmlHttp_global.send(null)
 
}

var p1,p2,p3,p4
function quoteAction(path,author,commentID,commentBodyId,field)
{
  p1=author;
  p2=commentID;
  p3=commentBodyId;
  p4=field;
  var url=path+"user/save_comment_info.php?comid="+commentID+"&mode=O";

		xmlHttp_global=GetXmlHttpObjectGlobal(showQuote)
		xmlHttp_global.open("GET", url , true)
		xmlHttp_global.send(null)
}

function saveCommentInfo() 
{ 
		if (xmlHttp_global.readyState==4 || xmlHttp_global.readyState=="complete")
		{ 	
		   window.location=linktag.href;
		} 
}

function showQuote() 
{ 
		if (xmlHttp_global.readyState==4 || xmlHttp_global.readyState=="complete")
		{ 	
		  if(xmlHttp_global.responseText != '')
 			{								
 				  
 				  var comment = xmlHttp_global.responseText;
      	var insertStr = '<blockquote cite="#' + p3 + '">';
      	insertStr += '\n<strong><a href="#' + p2 + '">' + p1.replace(/\t|\n/g, "") + '</a> :</strong>';
      	insertStr += comment.replace(/\t|\n/g, "");
      	insertStr += '</blockquote>\n';
      
      	insertComQuote(insertStr, p4); 
 			}
		} 
}



function writeMyReview(path,site)
{
  var url=path+"members/reviewer_redirect.php?toreview="+site;

		xmlHttp_global=GetXmlHttpObjectGlobal(stateRedirect)
		xmlHttp_global.open("GET", url , true)
		xmlHttp_global.send(null)
 
}


function stateRedirect() 
{ 
		if (xmlHttp_global.readyState==4 || xmlHttp_global.readyState=="complete")
		{ 
		  window.location=xmlHttp_global.responseText;
		} 
}

function showSubLevel(id,basepath)
	{ 
   var url=basepath+"user/load_sublevel.php?category="+ id;		
 
			xmlHttp_global=GetXmlHttpObjectGlobal(loadSubLevel)
			xmlHttp_global.open("GET", url , true)
			xmlHttp_global.send(null)
		
	} 

	
	
	
	function loadSubLevel() 
	{ 
		if (xmlHttp_global.readyState==4 || xmlHttp_global.readyState=="complete")
		{ 
		  document.getElementById('idtop_value').innerHTML =	xmlHttp_global.responseText;	
		} 
	}
  

function GetXmlHttpObjectGlobal(handler)
{ 
		var objXmlHttp_global=null
	
		if (navigator.userAgent.indexOf("Opera")>=0)
		{
			alert("This example doesn't work in Opera") 
			return 
		}
		if (navigator.userAgent.indexOf("MSIE")>=0)
		{ 
			var strName="Msxml2.XMLHTTP"
			if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
			{
				strName="Microsoft.XMLHTTP"
			} 
			try
			{ 
				objXmlHttp_global=new ActiveXObject(strName)
				objXmlHttp_global.onreadystatechange=handler 
				return objXmlHttp_global
			} 
			catch(e)
			{ 
				alert("Error. Scripting for ActiveX might be disabled") 
				return 
			} 
		} 
			if (navigator.userAgent.indexOf("Mozilla")>=0)
			{
				objXmlHttp_global=new XMLHttpRequest()
				objXmlHttp_global.onload=handler
				objXmlHttp_global.onerror=handler 
				return objXmlHttp_global
			}
	} 