var tp= new Image(10,10); 
tp.src="http://www.hdryers.com/images/loading.gif";
var tp2= new Image(10,10); 
tp2.src="http://www.hdryers.com/images/null.gif";
var rspid="";
var rspid2="";
var uu=member();
var u=uu;

var myhost=window.location.hostname;
if(myhost!='www.hdryers.com'){
	//alert('Please don\'t steal this Web content from www.hdryers.com.');
	//document.location.href='http://www.hdryers.com/';	
}

function thumb(v,pid,rid){
	var mypost="rate="+v+"&id="+rid;
	rspid='rsp_'+pid+'_'+rid;
	makePost2('/thumb.php', mypost, "alertContents_thumb");
}
function alertContents_thumb() {
	ge(rspid).style.background="#FFFFFF";
	ge(rspid).style.color="#0000FF";
	ge(rspid).innerHTML= "<img src=\"http://www.hdryers.com/images/loading.gif\" align=\"absmiddle\"> Waiting...";
	      if (http_request.readyState == 4) {
	      	 if (http_request.status == 200) {
	      	 	var result = http_request.responseText;
	            if(result.match(/^err:(.+)$/ig)){
	            	ge(rspid).style.color="#FF0000";
	            	ge(rspid).style.background="#FFe4E4";
	            	ge(rspid).innerHTML=RegExp.$1;
	            }else{
	            	ge(rspid).style.color="#008000";
	            	ge(rspid).style.background="#FFFFFF";
	            	ge(rspid).innerHTML=result;
	            }
	         } else {
	            alert('There was a problem with the request. ['+http_request.status+']');
	         }
	      }
}

function chkavail(uname){
	if(gev(uname).length < 3){
		alert("Please enter the Username (at least 3 characters)!");
	}else{
		var mypost="u="+gev(uname);
		rspid='checkavail';
		makePost2('/chkavail.php', mypost, "alertContents_chkavail");
	}
}
function alertContents_chkavail() {
	ge(rspid).style.background="#FFFFFF";
	ge(rspid).style.color="#0000FF";
	ge(rspid).innerHTML= "<img src=\"http://www.hdryers.com/images/loading.gif\" align=\"absmiddle\"> Checking Now... Waiting...";
	      if (http_request.readyState == 4) {
	      	 if (http_request.status == 200) {
	      	 	var result = http_request.responseText;
	            if(result.match(/^err:(.+)$/ig)){
	            	ge(rspid).style.color="#FF0000";
	            	ge(rspid).style.background="#FFe4E4";
	            	ge(rspid).innerHTML=RegExp.$1;
	            }else{
	            	ge(rspid).style.color="#008000";
	            	ge(rspid).style.background="#FFFFFF";
	            	ge(rspid).innerHTML=result;
	            }
	         } else {
	            alert('There was a problem with the request. ['+http_request.status+']');
	         }
	      }
}

var interval = null;
var div = null;
function searchf(f){
	if(f.keyword.value==""){
		//alert("Please Enter the Search Term!");
		div = document.createElement('div');
		div.className="err";
		div.style.position="absolute";
		var _docWidth = (document.width !== undefined) ? document.width : document.body.offsetWidth;
		div.style.left=_docWidth/2+125;
		f.appendChild(div);
    	div.innerHTML="Please Enter the Search Term!";
    	interval = setInterval("del_div(\""+f.name+"\");", 1000);
		
		f.keyword.focus();
		return false;
	}else{
		return true;
	}
}

function del_div(ff){
	var obj=eval("document."+ff);
	obj.removeChild(div);
	if(interval != null){
		clearInterval(interval);
		interval = null;
	}
}

function passwds(f){
	if(f.username.value==""){
		alert("Please Enter the Username!");
		f.username.focus();
		return false;
	}else if(f.email.value==""){
		alert("Please Enter the Email!");
		f.email.focus();
		return false;
	}else{
		return true;
	}
}

function searchs(f){
	if(f.username.value==""){
		alert("Please Enter the Email or Username!");
		f.username.focus();
		return false;
	}else if(f.password.value==""){
		alert("Please Enter the Password!");
		f.password.focus();
		return false;
	}else{
		return true;
	}
}

function searchr(f){
	if(f.name.value==""){
		alert("Please Enter Your Name!");
		f.name.focus();
		return false;
	}else if(valid_email(f.email.value)){
		alert("Please Enter Your Email!");
		f.email.focus();
		return false;
	}else if(f.password.value==""){
		alert("Please Enter the Password!");
		f.password.focus();
		return false;
	}else if(f.confirmpw.value!=f.password.value){
		alert("Please Enter the Confirm Password!");
		f.confirmpw.focus();
		return false;
	}else if(f.username.value==""){
		alert("Please Enter Your Username!");
		f.username.focus();
		return false;
	}else if(f.authcode.value==""){
		alert("Please Enter Authority Code!");
		f.authcode.focus();
		return false;
	}else{
		return true;
	}
}

function valid_email(email){
	if (!email.match(/^([0-9a-z\-\._]+)@([0-9a-z\-]+)\.([0-9a-z\-\.]+)$/ig)){
		return (true);
	}else{
		return (false);
	}
}

function ge(obj){
   		return document.getElementById(obj);
}
   
function gev(obj){
   		return document.getElementById(obj).value;
}

function makeRequest2(murl, parameters,trg) {
          http_request = false;
	      if (window.XMLHttpRequest) { // Mozilla, Safari,...
	         http_request = new XMLHttpRequest();
	         if (http_request.overrideMimeType) {
	            http_request.overrideMimeType('text/html');
	         }
	      } else if (window.ActiveXObject) { // IE
	         try {
	            http_request = new ActiveXObject("Msxml2.XMLHTTP");
	         } catch (e) {
	            try {
	               http_request = new ActiveXObject("Microsoft.XMLHTTP");
	            } catch (e) {}
	         }
	      }
	      if (!http_request) {
	         alert('Cannot create XMLHTTP instance');
	         return false;
	      }
	      eval("http_request.onreadystatechange = "+trg+";");
	      http_request.open('GET', murl + parameters, true);
	      http_request.send(null);
}
   
function makePost2(murl, parameters,trg) {
          http_request = false;
	      if (window.XMLHttpRequest) { // Mozilla, Safari,...
	         http_request = new XMLHttpRequest();
	         if (http_request.overrideMimeType) {
	            http_request.overrideMimeType('text/html');
	         }
	      } else if (window.ActiveXObject) { // IE
	         try {
	            http_request = new ActiveXObject("Msxml2.XMLHTTP");
	         } catch (e) {
	            try {
	               http_request = new ActiveXObject("Microsoft.XMLHTTP");
	            } catch (e) {}
	         }
	      }
	      if (!http_request) {
	         alert('Cannot create XMLHTTP instance');
	         return false;
	      }
	      eval("http_request.onreadystatechange = "+trg+";");
	      http_request.open('POST', murl, true);
	      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	      http_request.setRequestHeader("Content-length", parameters.length);
	      http_request.setRequestHeader("Connection", "close");
	      http_request.send(parameters);
}

function set_cookie(name, value, expire) {
   	document.cookie = name + "=" + escape(value)+ ",; path=/" + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()));
}
	
function get_cookie(Name) {
		var nr='';
		var cookies=document.cookie;
		var cookies2="";
	    for (var i=0;i<cookies.length;++i) {
	       var chrn=cookies.charAt(i);
	       if (chrn!=" ") cookies2 += chrn;
	    }
	    var nvpair=cookies2.split(";");
	    for(var i=0;i<nvpair.length;++i){
	      var splitValues=nvpair[i].split("=");
	      if(splitValues[0]==Name){
	      	nr=unescape(splitValues[1]);
	      	break;	
	      }
	   }
	    return nr;
	}

function mycookie(name,value,act){
	      var today = new Date();
	      var expires = new Date();
	      if(act=="a"){
	      	expires.setTime(today.getTime() + 60*60*24*365);
	      	set_cookie(name,value,expires);
	      }else{
	      	delete_cookie(name);
	      }
}
	
function delete_cookie(name,path,domain){
		if(get_cookie(name)){
			document.cookie = name + "=" + ( ( path ) ? ";path=" + path : "") +
		( ( domain ) ? ";domain=" + domain : "" ) + ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
		}
}

function get_domain(){
	var dm=document.location.href;
	var re=/^http:\/\/([0-9a-z\-\.:]+)/ig;
	if(re.exec(dm)){
		return RegExp.$1;
	}else{
		return "";
	}
}

function member(){
	var dm=get_domain();
	var re=/^www.([0-9a-z\-\.:]+)/ig;
	if(re.exec(dm)){
		dm=RegExp.$1;
	}
	var ckn = dm.replace(/[^0-9a-z]/g,"_");
	var u = get_cookie2("_"+ckn);
	return u;
}

function get_cookie2(Name) {
		var nr='';
		var cookies=document.cookie;
		var cookies2="";
	    for (var i=0;i<cookies.length;++i) {
	       var chrn=cookies.charAt(i);
	       if (chrn!=" ") cookies2 += chrn;
	    }
	    var nvpair=cookies2.split(";");
	    for(var i=0;i<nvpair.length;++i){
	      var splitValues=nvpair[i].split("=");
	      if(splitValues[0]==Name){
	      	nr=unescape(splitValues[1]);
	      	break;	
	      }
	   }
	    return nr;
	}

function member_chk2(id){
		var obj=ge(id);
		if(obj){
		if(uu==""){
			obj.innerHTML='<a href="/member.html">Member Sign-in</a>';
		}else{
			obj.innerHTML='<a href="/member.php"><font color=red>'+uu+'</font></a> (<a href="/signout.php">sign out</a>).<br>';
		}
		}
	}
	
function is_register(id){
	var obj=ge(id);
	if(uu==""){
		obj.innerHTML='<input type="checkbox" name="register" value="1"> <img src=\"/images/user.gif\" align=\"absmiddle\"> <font color=\"#629500\">Register as a Member.</font>  (Already a Member? <a href="/signin.php">Sign in</a>)<br>';
		ge('cm_name').style.display="";
		ge('cm_email').style.display="";
		ge('cm_location').style.display="";
	}else{
		obj.innerHTML='<img src=\"/images/user.gif\" align=\"absmiddle\"> Welcome, <font color=#629500>'+uu+'</font> &raquo; <a href="/member.php">Edit Profile</a> (<a href="/signout.php">sign out</a>).<br>';
		ge('cm_name').style.display="none";
		ge('cm_email').style.display="none";
		ge('cm_location').style.display="none";
	}
		 
}

function regnow(){
	if(ge('cm_username').style.display==""){
		ge('cm_username').style.display="none";
		ge('cm_passwd').style.display="none";
	}else{
		ge('cm_username').style.display="";
		ge('cm_passwd').style.display="";
	}	
}

function is_register2(id){
	var uu=member();
	var obj=ge(id);
	if(uu==""){
		obj.innerHTML='<input type="checkbox" id="register" name="register" value="1" onclick="regnow();"> <img src=\"/images/user.gif\" align=\"absmiddle\"> <label for="register"><font color=\"#629500\">Register as a Member.</font></label><br>';
		ge('cm_name').style.display="";
		ge('cm_email').style.display="";
		ge('cm_location').style.display="";
		ge('cm_username').style.display="none";
		ge('cm_passwd').style.display="none";
		ge('signin').innerHTML='<p>  (Already a Member? <a href="/signin.php">Sign in</a>)</p>';
	}else{
		obj.innerHTML='<img src=\"/images/user.gif\" align=\"absmiddle\"> Welcome, <font color=#629500>'+uu+'</font>  (<a href="/signout.php">sign out</a>).<br>';
		ge('cm_name').style.display="none";
		ge('cm_email').style.display="none";
		ge('cm_location').style.display="none";
		ge('cm_username').style.display="none";
		ge('cm_passwd').style.display="none";
		ge('signin').innerHTML='<p>  Click "Continue" to finish your comment.</p>';
	}
		 
}

function chk_frm(f){
	var is_ok=false;
	var is_reg=true;
	if(f.register && f.register.checked){
		is_reg=false;
		if(f.Name.value==""){
			alert("Please enter Your Name for Registration!");
			f.Name.focus();	
			return false;
		}else if(valid_email(f.Email.value)){
			alert("Please enter Your Email for Registration!");
			f.Email.focus();	
			return false;
		}else{
			is_reg=true;
		}
	}
	if(f.Title.value==""){
		alert("Please enter Review Title!");
		f.Title.focus();
	}else if(!f.Rating_All[0].checked && !f.Rating_All[1].checked && !f.Rating_All[2].checked && !f.Rating_All[3].checked && !f.Rating_All[4].checked){
		alert("Please Rate this Product!");
		f.Rating_All[0].focus();	
	}else if(f.Contents.value==""){
		alert("Please enter Full Review!");
		f.Contents.focus();	
	}else if(f.authcode.value==""){
		alert("Please enter Authority Code!");
		f.authcode.focus();	
	}else{
		is_ok=true;
	}
	if(is_reg!=true){
		is_ok=false;
	}
	return is_ok;	
}

function chk_frm2(f){
	var is_ok=false;
	if(f.Title.value==""){
		alert("Please enter Review Title!");
		f.Title.focus();
	}else if(!f.Rating_All[0].checked && !f.Rating_All[1].checked && !f.Rating_All[2].checked && !f.Rating_All[3].checked && !f.Rating_All[4].checked){
		alert("Please Rate this Product!");
		f.Rating_All[0].focus();	
	}else if(f.Contents.value==""){
		alert("Please enter Full Review!");
		f.Contents.focus();	
	}else{
		is_ok=true;
	}
	return is_ok;	
}

function goaction3(f){
	var is_ok=false;
	var is_reg=true;
	var uu=member();
	//alert(uu);
	//if(uu==""){
		if(f.register && f.register.checked){
			is_reg=false;
			if(f.username.value==""){
				alert("Please enter User Name for Registration!");
				f.username.focus();	
				return false;
			}else if(f.passwd.value==""){
				alert("Please enter the Password for Registration!");
				f.passwd.focus();
				return false;
			}else{
				is_reg=true;
			}
		}
		if(f.Name.value==""){
			alert("Please Enter Your Name!");
			f.Name.focus();	
		}else if(valid_email(f.Email.value)){
			alert("Please enter Your Email!");
			f.Email.focus();	
		}else{
			is_ok=true;
		}
	//}else{
	//	is_ok=true;
	//}
	if(is_reg!=true){
		is_ok=false;
	}
	return is_ok;
}

function goaction2(f){
	var is_ok=false;
	if(f.Contents.value==""){
		alert("Please Enter your Answer!");
		f.Contents.focus();	
	}else{
		is_ok=true;
	}
	return is_ok;	
}

function goaction22(f){
	var is_ok=false;
	if(f.Contents.value==""){
		alert("Please Leave a Comment!");
		f.Contents.focus();	
	}else{
		is_ok=true;
	}
	return is_ok;	
}

function goaction(f){
	var is_ok=false;
	var is_reg=true;
	if(f.register && f.register.checked){
		is_reg=false;
		if(f.Name.value==""){
			alert("Please enter Your Name for Registration!");
			f.Name.focus();	
			return false;
		}else if(valid_email(f.Email.value)){
			alert("Please enter Your Email for Registration!");
			f.Email.focus();	
			return false;
		}else{
			is_reg=true;
		}
	}
	if(f.Contents.value==""){
		alert("Please leave a Comment!");
		f.Contents.focus();	
	}else{
		is_ok=true;
	}
	if(is_reg!=true){
		is_ok=false;
	}
	return is_ok;	
}

function showTools(id,kid,mid) {
	var el = ge(id);
	var pp = ge(kid);
	var bb=ge(mid);
	if(el.className == 'buryshare') {
		el.className = 'drillshare'
		var mew=get_vplace(pp);
		mev=mew[0]+1;
		meT=mew[1];
		var met=meS( );
		var mes=meR( );
		var temp=meT-mes[1]+bb.clientHeight+52;
		var temp2=met[1];
		var chk_v=parseInt(temp) - parseInt(temp2);
		if( chk_v >= 0){
			bb.style.top='0px';
			if(document.all){
				bb.style.top='-'+(bb.clientHeight+21)+'px'; 
			}else{
				bb.style.top='-'+(bb.clientHeight+18)+'px'; 
			}
		}else{
			bb.style.top='0px';
		}
	};
}

function rmTools(id) {
	var el = ge(id);
	if(el.className == 'drillshare') {el.className = 'buryshare'};
}

function addfav(mURL,mTitle){
	my_url=decodeURIComponent(mURL); 
	my_title=decodeURIComponent(mTitle); 
	if (document.all)window.external.AddFavorite(my_url,my_title); 
	else window.sidebar.addPanel(my_title,my_url,''); 
	return false; 	
}

function get_vplace(t){
		var meq=0,meP=0; 
		do {meq+=t.offsetTop || 0; meP+=t.offsetLeft || 0; t=t.offsetParent; }while (t); 
		return [meP,meq]; 
	}

function meS( ){
		var mep=0; 
		var meN=0; 
		if (typeof(window.innerWidth)=='number'){
			mep=window.innerWidth; 
			meN=window.innerHeight; 
		}else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)){
			mep=document.documentElement.clientWidth; 
			meN=document.documentElement.clientHeight; 
		}else if (document.body && (document.body.clientWidth || document.body.clientHeight)){
			mep=document.body.clientWidth; meN=document.body.clientHeight; 
		}
		return [mep,meN]; 
}

function meR( ){
		var men=0; 
		var meM=0; 
		if (typeof(window.pageYOffset)=='number'){
			meM=window.pageYOffset; 
			men=window.pageXOffset; 
		}else if (document.body && (document.body.scrollLeft || document.body.scrollTop)){
			meM=document.body.scrollTop; men=document.body.scrollLeft; 
		}else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)){
			meM=document.documentElement.scrollTop; 
			men=document.documentElement.scrollLeft; 
		}
		return [men,meM]; 
}

function compare(fid){
	var f = ge(fid);
	// check sum
	var arr=get_compare(fid);
	var arr_new=arr;
	if(arr.length<5){
		var is_f=0;
		for(var i=0;i<f.elements.length;i++){
			if(f.elements[i].type=='checkbox' && f.elements[i].id.match(/^p([0-9]+)$/ig)){
				if(f.elements[i].checked){
					is_f++;
					if(!in_array(f.elements[i].id,arr)){
						if(arr_new.length < 5){
							arr_new[arr_new.length]=f.elements[i].id;
						}else{
							alert("Sorry: select up to 5 products at a time!");
						}
					}
				}	
			}
		}
		// add
		if(arr.length+is_f < 2){
			alert("Please choose at least two products to compare!");
		}else{
			if(is_f > 0){
				var cks="";
				for(var j=0;j<arr_new.length;j++){
					cks+=arr_new[j]+",";
				}
				cks=cks.substring(0,cks.length-1);
				mycookie('compare_'+fid,cks,'a');
			}else{
				alert("Please choose products to compare!");
			}
		}
		// save
	}else{
		alert("Sorry: select up to 5 products at a time!");
	}
	
	display_comapre(fid);
	
}

function end_compare(fid,myurl){
	mycookie('compare_'+fid,'');
	//history.go(-1);
	document.location.href=myurl;
}

function display_comapre(fid){
	var new_temp=get_compare(fid);
	if(new_temp.length >=2 && new_temp.length <= 5){
		ge('cart').innerHTML='<font color=#008000>Total '+new_temp.length+' products to compare</font> <a href="/compare.php?f='+fid+'"><img src="/images/btn_search_compare.gif" align="absmiddle" height="20" hspace="5" width="120" border="0"></a>';
	}else{
		ge('cart').innerHTML='<font color=#008000>Total '+new_temp.length+' products to compare</font> ';
	}
}

function in_array(val,arr){
	var is_f=false;
	for(var j=0;j<arr.length;j++){
		if(val==arr[j]){
			is_f=true;
			break;
		}
	}
	return is_f;
}

function get_compare(fid){
	var dt=get_cookie2('compare_'+fid);
	var arr=new Array();
	if(dt.match(/p([0-9]+)/ig)){
		arr=dt.split(",");
	}
	var arr_new=new Array();
	var i=0;
	for(var j=0;j<arr.length;j++){
		if(arr[j]!=""){
			arr_new[i]=arr[j];
			i++;
		}
	}
	return arr_new;
}

function valid_ask(theForm){
  var is_ok=false;
  var is_reg=true;
	if(theForm.register && theForm.register.checked){
		is_reg=false;
		if(theForm.name.value==""){
			alert("Please enter Your Name for Registration!");
			theForm.name.focus();	
			return false;
		}else if(valid_email(theForm.email.value)){
			alert("Please enter Your Email for Registration!");
			theForm.email.focus();	
			return false;
		}else{
			is_reg=true;
		}
	}else{
		
	}
  
  if(valid_email(theForm.email.value)){
			alert("Please enter Your Email!");
			theForm.email.focus();	
	}else if (theForm.cats.value == ""){
    alert("Oops! Please Select a Category.");
    theForm.cats.focus();
  }else if (theForm.submitname.value == ""){
    alert("Oops! Please Name Your Question.");
    theForm.submitname.focus();
  }else if (theForm.description.value == ""){
    alert("Oops! Please Give a Description.");
    theForm.description.focus();
  }else{
  	is_ok=true;
  }
  if(is_reg!=true){
		is_ok=false;
  }

	return is_ok;
}

function valid_ask2(theForm){
  var is_ok=false;
  
  if (theForm.submitname.value == ""){
    alert("Oops! Please Name Your Question.");
    theForm.submitname.focus();
  }else{
  	is_ok=true;
  }

	return is_ok;
}

function thumbit(pid,rid,rs){
	var post="id="+pid+"&vote="+rid+"&"+rs+"=1";
	rspid2="thumbit_result_"+pid+"_"+rid;
	makePost2('/thumbit.php', post, "alertContents_tm");
}
function alertContents_tm() {
	ge(rspid2).innerHTML= "<img src='/images/loading.gif' align=absmiddle> Vote...";
	if (http_request.readyState == 4) {
		if (http_request.status == 200) {
			var result = http_request.responseText;
			ge(rspid2).innerHTML=result;
		} else {
			alert('There was a problem with the request. ['+http_request.status+']');
		}
	}
}

function quoteit2(pid,mid){
	if(document.cmform.Contents){
		var trg=document.cmform.Contents.value;
		if(trg.match(/\[quote=/i)){
		}else{
			var at=ge(pid+"name"+mid).innerHTML;
			var ct=ge(pid+"msg"+mid).innerHTML;
			ct = ct.replace(/<div class=\"fieldset\">Quote:<div class=\"legend\">(.+)<\/div><\/div>(.+)/gim,"$2");
			ct = ct.replace(/<br>/ig,"");
			document.cmform.Contents.value="[quote="+at+"]"+ct+"[/quote]"+trg;
			document.cmform.Contents.focus();
		}
	}
}

function quoteit(pid,mid){
	if(document.add_review.Contents){
		var trg=document.add_review.Contents.value;
		if(trg.match(/\[quote=/i)){
		}else{
			var at=ge(pid+"name"+mid).innerHTML;
			var ct=ge(pid+"msg"+mid).innerHTML;
			ct = ct.replace(/<div class=\"fieldset\">Quote:<div class=\"legend\">(.+)<\/div><\/div>(.+)/gim,"$2");
			ct = ct.replace(/<br>/ig,"");
			document.add_review.Contents.value="[quote="+at+"]"+ct+"[/quote]"+trg;
			document.add_review.Contents.focus();
		}
	}
}

var q_i=0;
var queue_trg=new Array();
var queue_rid=new Array();
function add_queue(trg,rid){
	var i=queue_trg.length;
	queue_trg[i]=trg;
	queue_rid[i]=rid;
}
function list_replys_mul(i){
	var trg,rid;
	if(queue_trg.length>0 && queue_trg[i]){
		trg=queue_trg[i];
		rid=queue_rid[i];
		var obj=ge(trg);
		if(obj){
			var post="rid="+rid;
			rspid2=trg;
			q_i=i;
			makePost2('/show-replies.php', post, "alertContents_listrpl_mul");
		}	
	}
}

function alertContents_listrpl_mul() {
	ge(rspid2).innerHTML= "<img src='/images/loading.gif' align=absmiddle> Loading...";
	if (http_request.readyState == 4) {
		 if (http_request.status == 200) {
			var result = http_request.responseText;
			
			var myData = json_parse(result);
            if(myData.err){
            	ge(rspid2).innerHTML=myData.err;
            }else{
            	var rt_data="";
            	if(myData.length==1){
            		rt_data+="<b>"+myData.length+" Reply</b><br>";
            	}else{
            		rt_data+="<b>"+myData.length+" Replies</b><br>";
            	}
            	for(var t=0;t<myData.length;t++){
            		rt_data+="<div class=\"rpl_item\" id=\"reply_id_"+myData[t].id+"\"><b>"+myData[t].name+"</b>'s reply at "+myData[t].date+":<div class=\"rpl_item2\"> "+myData[t].review+" </div></div>";
            	}
	         	ge(rspid2).innerHTML='<div class="replybox">'+rt_data+'</div>';   
	         	list_replys_mul(q_i+1);
			}
			
		} else {
			//alert('There was a problem with the request. ['+http_request.status+']');
		}
	}

}

function list_replys(trg,rid){
	var obj=ge(trg);
	if(obj){
		var post="rid="+rid;
		rspid2=trg;
		makePost2('/show-replies.php', post, "alertContents_listrpl");
	}	
}

function alertContents_listrpl() {
	ge(rspid2).innerHTML= "<img src='/images/loading.gif' align=absmiddle> Loading...";
	if (http_request.readyState == 4) {
		 if (http_request.status == 200) {
			var result = http_request.responseText;
			
			var myData = json_parse(result);
            if(myData.err){
            	ge(rspid2).innerHTML=myData.err;
            }else{
            	var rt_data="";
            	if(myData.length==1){
            		rt_data+="<b>"+myData.length+" Reply</b><br>";
            	}else{
            		rt_data+="<b>"+myData.length+" Replies</b><br>";
            	}
            	for(var t=0;t<myData.length;t++){
            		rt_data+="<div class=\"rpl_item\" id=\"reply_id_"+myData[t].id+"\"><b>"+myData[t].name+"</b>'s reply at "+myData[t].date+":<div class=\"rpl_item2\"> "+myData[t].review+" </div></div>";
            	}
	         	ge(rspid2).innerHTML='<div class="replybox">'+rt_data+'</div>';   
			}
			
		} else {
			//alert('There was a problem with the request. ['+http_request.status+']');
		}
	}
}

function reply(trg,rid){
	var obj=ge(trg);
	if(obj){
		if(obj.innerHTML==''){
			if(u==""){
				obj.innerHTML= '<div class="replybox"><form id="rplf'+rid+'" name="reply_form_'+rid+'" method="post"><textarea name="rpl_content" rows="5" cols="55"></textarea><br>Email<font color="#ff0000">*</font> <input size="20" value="" name="Email"><br>Name<font color="#ff0000">*</font> <input size="20" value="" name="Name"><br><input type="hidden" value="" name="Location"><input value="Post Reply" name="add_reply" type="button" onclick="javascript:chk_reply(\''+trg+'\','+rid+');"><input value="Cancel" name="cc_reply" type="button" onclick="javascript:hidereply(\''+trg+'\');"></form></div>';
			}else{
				obj.innerHTML= '<div class="replybox"><form id="rplf'+rid+'" name="reply_form_'+rid+'" method="post"><textarea name="rpl_content" rows="5" cols="55"></textarea><br><input value="Post Reply" name="add_reply" type="button" onclick="javascript:chk_reply(\''+trg+'\','+rid+');"><input value="Cancel" name="cc_reply" type="button" onclick="javascript:hidereply(\''+trg+'\');"></form></div>';
			}
		}else{
			obj.innerHTML= '';
		}
	}
}

function hidereply(trg){
	var obj=ge(trg);
	if(obj){
		obj.innerHTML= '';
	}
}

function chk_reply(trg,rid){
	var fobj=eval('document.reply_form_'+rid);
	var is_ok=false;
	if(fobj){
		if(fobj.rpl_content.value==""){
			alert("Please enter Your Reply!");
			fobj.rpl_content.focus();	
			is_ok=false;
		}else if(u=="" && fobj.Name.value==""){
			if(u==""){
				alert("Please enter Your Name!");
				fobj.Name.focus();	
				is_ok=false;
			}
		}else if(u=="" && fobj.Email.value==""){
			if(u==""){
				alert("Please enter Your Email!");
				fobj.Email.focus();	
				is_ok=false;
			}
		}else if(u=="" && valid_email(fobj.Email.value)){
			if(u==""){
				alert("Please enter Valid Email Address!");
				fobj.Email.focus();	
				is_ok=false;
			}
		}else{
			is_ok=true;
		}
	}
	if(is_ok){
		var post="";
		if(u==""){
			post="rid="+rid+"&Location="+fobj.Location.value+"&Name="+fobj.Name.value+"&Email="+fobj.Email.value+"&content="+fobj.rpl_content.value;
		}else{
			post="rid="+rid+"&content="+fobj.rpl_content.value;
		}
		rspid2=trg;
		makePost2('/reply.php', post, "alertContents_rpl");
	}
	
}

function alertContents_rpl() {
	ge(rspid2).innerHTML= "<img src='/images/loading.gif' align=absmiddle> Sending...";
	if (http_request.readyState == 4) {
		 if (http_request.status == 200) {
			var result = http_request.responseText;
			ge(rspid2).innerHTML=result;
			var t=setTimeout("hidereply('"+rspid2+"')",1000);
		} else {
			//alert('There was a problem with the request. ['+http_request.status+']');
		}
	}
}


var ol = "member_chk2('signin')";
window.onload = function() {eval(ol);};


