function smsg(msgStr) { //v1.0
  status=msgStr;
  document.prs_return = true;
}
function nosmsg(msgStr) { //v1.0
  status=msgStr;
  document.prs_return = true;
}

var tooltip=function(){
	var id = 'tt';
	var top = 3;
	var left = 3;
	var maxw = 300;
	var speed = 10;
	var timer = 20;
	var endalpha = 95;
	var alpha = 0;
	var tt,t,c,b,h;
	var ie = document.all ? true : false;
	return{
		show:function(v,w){
			if(tt == null){
				tt = document.createElement('div');
				tt.setAttribute('id',id);
				t = document.createElement('div');
				t.setAttribute('id',id + 'top');
				c = document.createElement('div');
				c.setAttribute('id',id + 'cont');
				b = document.createElement('div');
				b.setAttribute('id',id + 'bot');
				tt.appendChild(t);
				tt.appendChild(c);
				tt.appendChild(b);
				document.body.appendChild(tt);
				tt.style.opacity = 0;
				tt.style.filter = 'alpha(opacity=0)';
				document.onmousemove = this.pos;
			}
			tt.style.display = 'block';
			c.innerHTML = v;
			tt.style.width = w ? w + 'px' : 'auto';
			if(!w && ie){
				t.style.display = 'none';
				b.style.display = 'none';
				tt.style.width = tt.offsetWidth;
				t.style.display = 'block';
				b.style.display = 'block';
			}
			if(tt.offsetWidth > maxw){tt.style.width = maxw + 'px'}
			h = parseInt(tt.offsetHeight) + top;
			clearInterval(tt.timer);
			tt.timer = setInterval(function(){tooltip.fade(1)},timer);
		},
		pos:function(e){
			var u = ie ? event.clientY + document.documentElement.scrollTop : e.pageY;
			var l = ie ? event.clientX + document.documentElement.scrollLeft : e.pageX;
			tt.style.top = (u - h) + 'px';
			tt.style.left = (l + left) + 'px';
		},
		fade:function(d){
			var a = alpha;
			if((a != endalpha && d == 1) || (a != 0 && d == -1)){
				var i = speed;
				if(endalpha - a < speed && d == 1){
					i = endalpha - a;
				}else if(alpha < speed && d == -1){
					i = a;
				}
				alpha = a + (i * d);
				tt.style.opacity = alpha * .01;
				tt.style.filter = 'alpha(opacity=' + alpha + ')';
			}else{
				clearInterval(tt.timer);
				if(d == -1){tt.style.display = 'none'}
			}
		},
		hide:function(){
			clearInterval(tt.timer);
			tt.timer = setInterval(function(){tooltip.fade(-1)},timer);
		}
	};
}();

function deleteconfirm(str,strurl)
{
	if (confirm(str)) 
	{
		this.location=strurl;
	}
}	

function emailInvalid(s)
{
	if(!(s.match(/^[\w]+([_|\.-][\w]{1,})*@[\w]{2,}([_|\.-][\w]{1,})*\.([a-z]{2,4})$/i) ))
        {
		return false;
	}
	else
		return true;
}


function xmlhttpPost(strURL,t,val,inputObj) {

    pagename=GetPage();
	var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
	
	
	if(t==105)
	{
		if(document.getElementById("hidCategory").value.split(" ").join("")=="")
		{
			alert("Please Select Category from left side bar");
			//document.getElementById("category").focus();
			return false;
		}
		else if(document.getElementById("cat_name").value=="")
		{
			alert("Please enter product category");
			document.getElementById("cat_name").focus();
			return false;
		}
		else
		{
			cat_name1=document.getElementById("cat_name").value;
			cat_name=StrReplace("&","@amp",cat_name1);
			val1="&cat_name="+cat_name;
		}
	}
	else if(t==104)
	{
		brand1=document.getElementById("brand").value;
		brand=StrReplace("&","@amp",brand1);
		
		title1=document.getElementById("title").value;
		title=StrReplace("&","@amp",title1);
		
		review1=document.getElementById("review").value;
		review=StrReplace("&","@amp",review1);
		review=StrReplace("\n","<br>",review);
		
		address1=document.getElementById("address").value;
		address=StrReplace("&","@amp",address1);

		review_type1="";
		if(document.addprod.review_type[0].checked==true)
		{
			review_type1="PR";
		}
		if(document.addprod.review_type[1].checked==true)
		{
			review_type1="PL";
		}
		
		theChoiceJ=document.getElementById("theChoiceJ").value;
		theChoiceJNew=document.getElementById("theChoiceJNew").value;
		val1="&review_type="+review_type1+"&brand="+brand+"&title="+title+"&address="+address+"&review="+review+"&rating="+document.getElementById("rating").value+"&srating="+document.getElementById("srating").value+"&qrating="+document.getElementById("qrating").value+"&prating="+document.getElementById("prating").value+"&theChoiceJ="+theChoiceJ+"&theChoiceJNew="+theChoiceJNew;

	}
	else if(t==102)
	{
		if(val=="Sub")
			val1="&ctype=Sub";
		else
			val1="&ctype=Add";
	}
	else if(t==101)
	{
		val1="?email="+val;
	}
	else if(t==11)
	{
		if(val=="Sub" || val=="Ssub")
			val1="&ctype=Sub";
		else if(val=="BSub")
			val1="&ctype=BSub";
		else
			val1="&ctype=Add";
		
		if(val!="Ssub" && val!="BSub")
		{
			var tmpstr=strURL;
			var tmpstr1=tmpstr.split("=");
			val=tmpstr1[1];
		}
		
	}
	else if(t==10)
	{
		var tmpval1="";
		if (pagename=="promotion_add.php" || pagename=="marketplace_add.php" || pagename=="shoplist_add.php" || pagename=="review_add.php" || pagename=="shopchoice_add.php")
		{
			tmpval1="&flag=add";
		}
		if(val=="Sub" || val=="Ssub" || val=="BSub")
			val1="&ctype=Sub"+tmpval1;
		
		else
			val1="&ctype=Add"+tmpval1;
		
		//if(val!="S" && val!="Ssub" && val!="BSub")
		if(val!="BSub")
		{
			var tmpstr=strURL;
			var tmpstr1=tmpstr.split("=");
			val=tmpstr1[1];
		}
	}
	else if(t==9)
	{
		ddCredit=document.getElementById("ddCreditCard").value;
		//ddDebit=document.getElementById("ddDebitCard").value;
		ddDebit="";
		
		brand1=document.getElementById("brand").value;
		brand=StrReplace("&","@amp",brand1);
		
		title1=document.getElementById("title").value;
		title=StrReplace("&","@amp",title1);
		
		descri1=document.getElementById("descri").value;
		descri=StrReplace("&","@amp",descri1);
		descri=StrReplace("\n","<br>",descri);
		
		saving1=document.getElementById("saving").value
		saving=StrReplace("&","@amp",saving1);
		
		remark1=document.getElementById("remarks").value;
		remark=StrReplace("&","@amp",remark1);
		remark=StrReplace("\n","<br>",remark);
		
		theChoiceJ=document.getElementById("theChoiceJ").value;
		theChoiceJNew=document.getElementById("theChoiceJNew").value;
		
		var frm_name=document.getElementById("addprod");
		var TotEle_Form=frm_name.elements.length;
		var rad_val="";
		for(fi=0;fi<TotEle_Form;fi++)
		{
			if(frm_name.elements[fi].type=='checkbox')
			{
				var chkname=frm_name.elements[fi].id;
				
				var pos1=chkname.indexOf("rdRequirement");
				if(frm_name.elements[fi].checked==true && pos1 >= 0)
				{
					rad_val+=frm_name.elements[fi].value+",";
				}
			}
		}
		val1="&category="+document.getElementById("category").value+"&subcategory="+document.getElementById("subcategory").value +"&brand="+brand+"&title="+title+"&price="+document.getElementById("price").value+"&saving="+saving+"&descri="+ descri +"&rdRequirement="+rad_val+"&ddCreditCard="+document.getElementById("ddCreditCard").value+"&ddDebitCard=&txtOther="+document.getElementById("txtOther").value+"&ddCredit="+ddCredit+"&ddDebit="+ddDebit+"&remark="+ remark +"&txtFromDate="+document.getElementById("txtFromDate").value+"&txtToDate="+document.getElementById("txtToDate").value+"&theChoice="+theChoiceJ+"&theChoiceJNew="+theChoiceJNew;
		//alert(val1);
	}
	else if(t==8)
	{
		/*if(val=="")
		{
			//alert("Please Login to Add this promotion to Your Bookmark");
			crossobj=ns6? document.getElementById("showimage_message") : document.all.showimage_message

			if (ie4||ns6)
				crossobj.style.visibility="visible"
			else if (ns4)
				document.showimage_message.visibility="visible"

			document.getElementById("tdPreview_message").innerHTML="Please login to access your bookmarks";
			
			document.getElementById("showimage_message").style.display="inline";
			return false;
		}
		else
		{*/
		//var newpos=getleftPos(inputObj)-150;
		var newtoppos=getTopPos(inputObj)-75;
		var LeftPosition = (screen.width/2)-(300/2);
		document.getElementById("showimage_message").style.left = LeftPosition + 'px';
		document.getElementById("showimage_message").style.top = newtoppos + 'px';
		
		var pagename=GetPage();
		if(pagename=="promotion_details.php" || pagename=="shoplist_details_map.php"  || pagename=="marketplace_details.php")
		{
			document.getElementById("showimage_message_details").style.left = LeftPosition + 'px';
			document.getElementById("showimage_message_details").style.top = newtoppos + 'px';
		}
		val1="&uid="+val;
		//}
	}
	else if(t==7)
	{
		val1="?username="+val;
	}
	else if(t==6)
	{
		val1="?username="+val;
	}
	else if(t==5)
	{
		val1="?type=E&email="+val+"&utype="+document.getElementById("usertype").value;
	}
	else if(t==4)
	{
		if(document.getElementById("usertype").value=="")
		{
			alert("Please Select Usertype");
			document.getElementById("usertype").focus();
			document.getElementById("username").value="";
			return false;
		}
		else
		{
			val1="?type=U&username="+val+"&utype="+document.getElementById("usertype").value;
		}
	}
	else if(t==3)
	{
		ddCredit=document.getElementById("ddCreditCard").value;
		ddDebit="";
		//ddDebit=document.getElementById("ddDebitCard").value;
		
		brand1=document.getElementById("brand").value;
		brand=StrReplace("&","@amp",brand1);
		
		title1=document.getElementById("title").value;
		title=StrReplace("&","@amp",title1);
		
		descri1=document.getElementById("descri").value;
		descri=StrReplace("&","@amp",descri1);
		descri=StrReplace("\n","<br>",descri);
		
		terms1=document.getElementById("terms").value;
		terms=StrReplace("&","@amp",terms1);
		terms=StrReplace("\n","<br>",terms);
		
		theChoiceJ=document.getElementById("theChoiceJ").value;
		theChoiceJNew=document.getElementById("theChoiceJNew").value;
		
		var frm_name=document.getElementById("addprod");
		var TotEle_Form=frm_name.elements.length;
		var rad_val="";
		var outname1="";
		var address1="";
		for(fi=0;fi<TotEle_Form;fi++)
		{
			if(frm_name.elements[fi].type=='checkbox')
			{
				var chkname=frm_name.elements[fi].id;
				var pos1=chkname.indexOf("rdRequirement");
				if(frm_name.elements[fi].checked==true && pos1>=0)
				{
					rad_val+=frm_name.elements[fi].value+",";
				}
			}
			
		}
		
		var outname = document.getElementsByName("outletname[]");
		var addressval = document.getElementsByName("address[]");
		for (var x = 0; x < outname.length; x++) {
			outname1+=outname[x].value+"@@@";
			address1+=addressval[x].value+"@@@";
		}
		//val1="&category="+document.getElementById("category").value+"&subcategory="+document.getElementById("subcategory").value +"&brand="+document.getElementById("brand").value+"&title="+document.getElementById("title").value+"&url="+document.getElementById("url").value+"&phone="+document.getElementById("phone").value+"&descri="+document.getElementById("descri").value+"&rdRequirement="+document.getElementById("rdRequirement").value+"&ddCreditCard="+document.getElementById("ddCreditCard").value+"&ddDebitCard="+document.getElementById("ddDebitCard").value+"&txtOther="+document.getElementById("txtOther").value+"&ddCredit="+ddCredit+"&ddDebit="+ddDebit+"&terms="+document.getElementById("terms").value+"&txtFromDate="+document.getElementById("txtFromDate").value+"&txtToDate="+document.getElementById("txtToDate").value;
		val1="&category="+document.getElementById("category").value+"&subcategory="+document.getElementById("subcategory").value +"&brand="+brand+"&title="+title+"&url="+document.getElementById("url").value+"&phone="+document.getElementById("phone").value+"&descri="+ descri +"&rdRequirement="+rad_val+"&ddCreditCard="+document.getElementById("ddCreditCard").value+"&ddDebitCard=&txtOther="+document.getElementById("txtOther").value+"&ddCredit="+ddCredit+"&ddDebit="+ddDebit+"&terms="+ terms +"&txtFromDate="+document.getElementById("txtFromDate").value+"&txtToDate="+document.getElementById("txtToDate").value+"&theChoice="+theChoiceJ+"&theChoiceJNew="+theChoiceJNew+"&outname="+outname1+"&outaddress="+address1;
	}
	else if(t==2)
	{
		//val1="&oname="+document.getElementById("outletname").value+"&oadd="+document.getElementById("address").value;
		val1="&mtype="+val;
	}
	else
	{
		val1="?cid="+val;
	}
	
	//alert(strURL+val1);
	self.xmlHttpReq.open('POST', strURL+val1, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    
	self.xmlHttpReq.onreadystatechange = function() 
    {	
		if(t==1)
			progresspage("subcategory","select-one","addprod");
		
		if (self.xmlHttpReq.readyState == 4) {
			//alert(self.xmlHttpReq.responseText);
            updatepage(self.xmlHttpReq.responseText,t,val);
        }
    }
    self.xmlHttpReq.send(null);
	/*if(t==2)
		alert("Outlet has been added Successfully");*/
}

function progresspage(FieldId,FieldType,FrmName)
{
	switch (FieldType) 
	{	
		case 'text':
		var Field = eval("document." + FrmName + "." +FieldId);
		Field.value = "Loading...";
		break;
	
		case 'select-one':
		var Field = eval("document." + FrmName + "." +FieldId);
		Field.options.length=null;
		option1 = new Option("Loading...","");
		Field.options[0] = option1;
		Field.disabled=true;
		break;
		
		case 'div':
		document.getElementById(FieldId).innerHTML = "Loading...";
		break;
	}
}

function updatepage(str,s,val)
{
 	pagename=GetPage();
	if(s==1)
		document.getElementById("md1").innerHTML= str;
	else if(s==3 || s==9 || s==104)
	{
		document.getElementById("tdPreview").innerHTML= str;
	}
	else if(s==2)
	{
		/*document.getElementById("tdGoogleMap").style.width="350";
		document.getElementById("tdGoogleMap").style.height="300";
		document.getElementById("tdGoogleMap").innerHTML= str;
		alert(document.getElementById("tdGoogleMap").innerHTML);*/
	}
	else if(s==4)
	{
		if(str=="No")
		{
			document.getElementById("foo").innerHTML="Username Already Exists";
			document.getElementById("username").value="";
			document.getElementById("username").focus();
		}
		else
		{
			document.getElementById("foo").innerHTML="";
		}
	}
	else if(s==5)
	{
		if(str=="No")
		{
			document.getElementById("fooEmail").innerHTML="Email Address Already Exists";
			document.getElementById("email").value="";
			document.getElementById("email").focus();
		}
		else
		{
			document.getElementById("fooEmail").innerHTML="";
		}
	}
	else if(s==6)
	{
		if(str=="No")
		{
			document.getElementById("foo").innerHTML="Invalid Username";
			document.getElementById("username").value="";
			document.getElementById("username").focus();
		}
		else
		{
			document.getElementById("foo").innerHTML="";
		}
	}
	else if(s==7)
	{
		if(str=="No")
		{
			document.getElementById("Leftfoo").innerHTML="Invalid Username";
			document.getElementById("Leftusername").focus();
			document.getElementById("Leftusername").value="Username";
			document.getElementById("Leftpass").value="******";
		}
		else
		{
			document.getElementById("Leftfoo").innerHTML="";
		}
	}
	else if(s==8)
	{
		var pagename=GetPage();
		if(str!="")
		{
			if(pagename=="promotion_details.php" || pagename=="shoplist_details_map.php"  || pagename=="marketplace_details.php")
			{
				crossobj=ns6? document.getElementById("showimage_message_details") : document.all.showimage_message_details
	
				if (ie4||ns6)
					crossobj.style.visibility="visible"
				else if (ns4)
					document.showimage_message_details.visibility="visible"
	
				document.getElementById("ifmTest_details").src="top_message.php?str="+str;
				
				document.getElementById("showimage_message_details").style.display="inline";
			}
			else
			{
				crossobj=ns6? document.getElementById("showimage_message") : document.all.showimage_message
	
				if (ie4||ns6)
					crossobj.style.visibility="visible"
				else if (ns4)
					document.showimage_message.visibility="visible"
	
				document.getElementById("tdPreview_message").innerHTML=str;
				
				document.getElementById("showimage_message").style.display="inline";
			}
		}
	}
	else if(s==10)
	{
		//if(val!="S" && val!="Ssub" && val!="BSub")
		//alert(str);
		if(val!="Ssub" && val!="BSub")
		{
			if(val > 0)
			{
				if(document.getElementById("idLeft"+val).className=="")
				{
					document.getElementById("idLeft"+val).className="leftbackcolor";
				}
				else
				{
					document.getElementById("idLeft"+val).className="";
				}
			}
		}
		//alert(str + "==>" + pagename)
		if(pagename=="" || pagename=="index.php" || pagename=="advertise.php" || pagename=="contactus.php" || pagename=="privacypolicy.php" || pagename=="aboutus.php" || pagename=="deskboard.php" || pagename=="mybookmark.php" || pagename=="register.php" || pagename=="login.php" || pagename=="forgotpass.php")
		{
			window.location.href='search_result.php?srh=All';
		}
		else if(str=="ST" && pagename=="search_result.php")
		{
			window.location.href='index.php';
		}
		else
		{
			var tmpreq=GetQueryString_VarName();
			
			if(str=="N" && pagename!="search_result.php" && tmpreq!="search")
			{
				if(pagename=="promotion_listing.php")
				{
					window.location.href="promotion.php";
				}
				else if(pagename=="marketplace_listing.php")
				{
					window.location.href="marketplace.php";
				}
				else if(pagename=="shoplist_listing.php")
				{
					window.location.href="shoplist.php";
				}
				else if(pagename=="review_listing.php")
				{
					window.location.href="reviews.php";
				}
				else
				{
					document.getElementById("tdSelCategory").innerHTML="<input type='hidden' name='hidCategory' id='hidCategory' value=''>";
				}
			}
			else
			{
				if(str=="N" || str=="ST")
				{
					str="";
				}

				var strkey=str.split("<==>");
				var srh="";
				if(strkey.length>1)
				{
					//str=strkey[0];  4th Jan 2009
					//srh=strkey[1];
					if(strkey[0]!="")
					{
						str=strkey[0]+"<tr><td>"+strkey[1]+"</td></tr>";
					}
					else
					{
						str=strkey[1];
					}
				}
				else
				{
					str=str;
				}
				newstr="<table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'>"+str+"</table>";
				
				if(pagename=="marketplace_listing.php" || pagename=="search_result.php" || pagename=="promotion_listing.php" || pagename=="shopchoice_listing.php" || pagename=="promotion_add.php" || pagename=="marketplace_add.php" || pagename=="review_add.php" || pagename=="review_listing.php" || pagename=="shopchoice_add.php" || pagename=="shoplist_add.php"  || pagename=="shoplist_listing.php")
				{
					document.getElementById("tdSelCategory").innerHTML=newstr;
					if(pagename=="search_result.php")
					{
						document.getElementById("tdKeywords").innerHTML=srh;
					}
				}
				
				if(pagename=="search_result.php")
				{
					xmlhttpPost_Result('search_promotion.php','11','S');
					xmlhttpPost_Market('search_marketplace.php','12','S');
					xmlhttpPost_Shoplist('search_shoprslist.php','1','S');
					xmlhttpPost_Shopchoice('search_shopchoice.php','1','S');
					xmlhttpPost_Review('search_review.php','1','S');
				}
				else if(pagename=="promotion.php" || pagename=="promotion_details.php" || pagename=="mypromotion.php" || pagename=="mybookpromotion.php")
				{
					window.location.href='promotion_listing.php';
				}
				else if(pagename=="promotion_listing.php")
				{
					xmlhttpPost_PromotionListing('search_promotion_listing.php?1=1','1','0');
				}
				else if(pagename=="marketplace.php" || pagename=="marketplace_details.php" || pagename=="mymarketplace.php" || pagename=="mybookmarketplace.php")
				{
					window.location.href='marketplace_listing.php';
				}
				else if(pagename=="marketplace_listing.php")
				{
					xmlhttpPost_MarketListing('search_marketplace_listing.php?1=1','1','0');
				}
				else if(pagename=="shoplist.php" || pagename=="shoplist_details.php" || pagename=="myshoplist.php" || pagename=="mybookshoplist.php")
				{
					window.location.href='shoplist_listing.php';
				}
				else if(pagename=="shoplist_listing.php")
				{
					xmlhttpPost_ShopListListing('search_shoplist_listing.php?1=1','1','0');
				}
				else if(pagename=="reviews.php" || pagename=="review_details.php" || pagename=="myreview.php" || pagename=="mybookreview.php")
				{
					window.location.href='review_listing.php';
				}
				else if(pagename=="review_listing.php")
				{
					xmlhttpPost_ReviewListing('search_review_listing.php?1=1','1','0');
				}
				else if(pagename=="shopchoice_details.php")
				{
					window.location.href='shopchoice_listing.php';
				}
				else if(pagename=="shopchoice_listing.php")
				{
					xmlhttpPost_ShopChoiceListing('search_shopchoice_listing.php?1=1','1','0');
				}
			}
		}
	}
	else if(s==11)
	{
		//alert(str);
		if(str=="ST")
			str="";
			
		var tmpreq=GetQueryString_VarName();
		if(str=="N" && pagename!="search_result.php" && pagename!="shopchoice_listing.php" && tmpreq!="search")
		{
			if(pagename=="promotion_listing.php")
			{
				window.location.href="promotion.php";
			}
			else if(pagename=="marketplace_listing.php")
			{
				window.location.href="marketplace.php";
			}
			else if(pagename=="shoplist_listing.php")
			{
				window.location.href="shoplist.php";
			}
			else if(pagename=="review_listing.php")
			{
				window.location.href="reviews.php";
			}
			else
			{
				document.getElementById("tdSelCategory").innerHTML="<input type='hidden' name='hidCategory' id='hidCategory' value=''>";
			}
		}
		else
		{
			if(str=="N")
			{
				str="";
			}
			
			var strkey=str.split("<==>");
			var srh="";
			if(strkey.length>1)
			{
				if(strkey[0]!="")
				{
					str=strkey[0]+"<tr><td>"+strkey[1]+"</td></tr>";
				}
				else
				{
					str=strkey[1];
				}
			}
			else
			{
				str=str;
			}
			
			newstr="<table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'>"+str+"</table>";
			if(pagename=="marketplace_listing.php" || pagename=="promotion_listing.php"  || pagename=="shopchoice_listing.php" || pagename=="promotion_add.php"  || pagename=="marketplace_add.php" || pagename=="shoplist_listing.php" || pagename=="review_add.php" || pagename=="review_listing.php" || pagename=="reviews_review.php" || pagename=="shopchoice_add.php"  || pagename=="shopchoice_listing.php" || pagename=="shoplist_add.php" || pagename=="shoplist_listing.php")
			{
				if(str=="")
				{
					document.getElementById("tdSelCategory").innerHTML="<input type='hidden' name='hidCategory' id='hidCategory' value=''>";
				}
				else
				{
					document.getElementById("tdSelCategory").innerHTML=newstr;
				}
			}
			
			if((val=="0&brand") || (val=="BSub"))	
			{
				var strvalue=GetQueryString();
				var strvars=GetQueryString_VarName();
				//alert(GetQueryString_Second()+"==>"+strvalue);
				var secvar=GetQueryString_Second_var();
				var secval=GetQueryString_Second_val();
				var strqry="";
				if(strvars=="sortby")
				{
					strqry="&sortby="+strvalue;
				}
				if(secvar=="asort")
				{
					strqry=strqry + "&asort="+secval;
				}
				if(secvar=="dsort")
				{
					strqry=strqry + "&dsort="+secval;
				}
				if(secvar=="rsort")
				{
					strqry=strqry + "&rsort="+secval;
				}
				//alert(strqry);
				if(pagename=="promotion_listing.php")
				{
					xmlhttpPost_PromotionListing('search_promotion_listing.php?1=1'+strqry,'1','0');
				}
				else if(pagename=="marketplace_listing.php")
				{
					xmlhttpPost_MarketListing('search_marketplace_listing.php?1=1'+strqry,'1','0');
				}
				else if(pagename=="shoplist_listing.php")
				{
					xmlhttpPost_ShopListListing('search_shoplist_listing.php?1=1'+strqry,'1','0');
				}
				else if(pagename=="review_listing.php")
				{
					xmlhttpPost_ReviewListing('search_review_listing.php?1=1','1','0');
				}
				else if(pagename=="shopchoice_listing.php")
				{
					xmlhttpPost_ShopChoiceListing('search_shopchoice_listing.php?1=1','1','0');
				}
			}
		}
	}
	else if(s==101)
	{
		if(str=="No")
		{
			document.getElementById("foo").innerHTML="Invalid Email Address";
			document.getElementById("email").value="";
			document.getElementById("email").focus();
		}
		else
		{
			document.getElementById("foo").innerHTML="";
		}
	}
	else if(s==102)
	{
		strvars1=0;
		var strvars=GetQueryString();
		if(strvars>=0)
		{
			strvars1=strvars;	
		}
		document.getElementById("tdSelOptions").innerHTML=str;
		xmlhttpPost_ShopListListing('search_shoplist_listing.php?1=1','1',strvars1);
	}
	else if(s==105)
	{
		document.getElementById("trSearchResult").innerHTML=str;
	}
	/*else if(s==103)
	{
		strvars1=0;
		var strvars=GetQueryString();
		if(strvars>=0)
		{
			strvars1=strvars;	
		}
		document.getElementById("tdSelUserOptions").innerHTML=str;
		xmlhttpPost_ShopListListing('search_shoplist_listing.php?1=1','1',strvars1);
	}*/
	
	
}

// for Marketplace
function xmlhttpPost_User(strURL,t,val,pagename)
{
	var xmlHttpReq_User = false;
	var self = this;
	// Mozilla/Safari
	if (window.XMLHttpRequest) {
		self.xmlHttpReq_User = new XMLHttpRequest();
	}
	// IE
	else if (window.ActiveXObject) {
		self.xmlHttpReq_User = new ActiveXObject("Microsoft.XMLHTTP");
	}
	//alert("view_totalcomment.php?scid="+scid);
	
	if(t==103)
	{
		if(val=="Sub")
			val1="&ctype=Sub";
		else
			val1="&ctype=Add";
	}
	//alert(strURL+val1+"&pgname="+pagename);
	self.xmlHttpReq_User.open('POST', strURL+val1+"&pgname="+pagename, true);
	self.xmlHttpReq_User.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	
	self.xmlHttpReq_User.onreadystatechange = function() 
	{	
		if (self.xmlHttpReq_User.readyState == 4) {
			updatepage_User(self.xmlHttpReq_User.responseText,t,pagename);
		}
	}
	self.xmlHttpReq_User.send(null);
}

function updatepage_User(str,s,pagename)
{
	if(s=="103")
	{
		strvars1=0;
		var strvars=GetQueryString();
		var varname=GetQueryString_VarName();
		if(strvars>=0 && varname!="uid")
		{
			strvars1=strvars;	
		}
		
		//alert(str);
		
		document.getElementById("tdSelUserOptions").innerHTML=str;
		
		if(pagename=="Promotion")
		{
			xmlhttpPost_PromotionListing('search_promotion_listing.php?1=1','1',strvars1);
		}
		else if(pagename=="Market")
		{
			xmlhttpPost_MarketListing('search_marketplace_listing.php?1=1','1',strvars1);
		}
		else if(pagename=="Shopchoice")
		{
			xmlhttpPost_ShopChoiceListing('search_shopchoice_listing.php?1=1','1',strvars1);
		}
		else if(pagename=="Review")
		{
			xmlhttpPost_ReviewListing('search_review_listing.php?1=1','1',strvars1);
		}
		
		if(str=="")
		{
			//document.getElementById("tdSelCategory").innerHTML="<tr><td>(No categories selected yet, please select from the side bar to narrow your search)<input type='hidden' name='hidCategory' id='hidCategory' value=''></td></tr>";
		}
	}
}
// End of Marketplace

function xmlhttpPost_ShopUser(strURL,t,val)
{
	var xmlHttpReq_ShopUser = false;
	var self = this;
	// Mozilla/Safari
	if (window.XMLHttpRequest) {
		self.xmlHttpReq_ShopUser = new XMLHttpRequest();
	}
	// IE
	else if (window.ActiveXObject) {
		self.xmlHttpReq_ShopUser = new ActiveXObject("Microsoft.XMLHTTP");
	}
	//alert("view_totalcomment.php?scid="+scid);
	
	if(t==103)
	{
		if(val=="Sub")
			val1="&ctype=Sub";
		else
			val1="&ctype=Add";
	}
	self.xmlHttpReq_ShopUser.open('POST', strURL+val1, true);
	self.xmlHttpReq_ShopUser.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	
	self.xmlHttpReq_ShopUser.onreadystatechange = function() 
	{	
		if (self.xmlHttpReq_ShopUser.readyState == 4) {
			updatepage_ShopUser(self.xmlHttpReq_ShopUser.responseText,t);
		}
	}
	self.xmlHttpReq_ShopUser.send(null);
}

function updatepage_ShopUser(str,s)
{
	if(s=="103")
	{
		strvars1=0;
		var strvars=GetQueryString();
		var varname=GetQueryString_VarName();
		if(strvars>=0 && varname!="uid")
		{
			strvars1=strvars;	
		}
		
		var strvalue=GetQueryString();
		var strvars_new=GetQueryString_VarName();
		var strqry="";
		if(strvars_new=="sortby")
		{
			strqry="&sortby="+strvalue;
		}
		
		document.getElementById("tdSelUserOptions").innerHTML=str;
		xmlhttpPost_ShopListListing('search_shoplist_listing.php?1=1'+strqry,'1',strvars1);
	}
}

/////// For Pop up box ////////////////
var ns4=document.layers
var ie4=document.all
var ns6=document.getElementById&&!document.all

//drag drop function for NS 4////
/////////////////////////////////

var dragswitch=0
var nsx
var nsy
var nstemp

function drag_dropns(name){
if (!ns4)
return
temp=eval(name)
temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
temp.onmousedown=gons
temp.onmousemove=dragns
temp.onmouseup=stopns
}

function gons(e){
temp.captureEvents(Event.MOUSEMOVE)
nsx=e.x
nsy=e.y
}
function dragns(e){
if (dragswitch==1){
temp.moveBy(e.x-nsx,e.y-nsy)
return false
}
}

function stopns(){
temp.releaseEvents(Event.MOUSEMOVE)
}

//drag drop function for ie4+ and NS6////
/////////////////////////////////


function drag_drop(e){
if (ie4&&dragapproved){
crossobj.style.left=tempx+event.clientX-offsetx
crossobj.style.top=tempy+event.clientY-offsety
return false
}
else if (ns6&&dragapproved){
crossobj.style.left=tempx+e.clientX-offsetx+"px"
crossobj.style.top=tempy+e.clientY-offsety+"px"
return false
}
}

function initializedrag(e){
crossobj=ns6? document.getElementById("showimage") : document.all.showimage
var firedobj=ns6? e.target : event.srcElement
var topelement=ns6? "html" : document.compatMode && document.compatMode!="BackCompat"? "documentElement" : "body"
while (firedobj.tagName!=topelement.toUpperCase() && firedobj.id!="dragbar"){
firedobj=ns6? firedobj.parentNode : firedobj.parentElement
}

if (firedobj.id=="dragbar"){
offsetx=ie4? event.clientX : e.clientX
offsety=ie4? event.clientY : e.clientY

tempx=parseInt(crossobj.style.left)
tempy=parseInt(crossobj.style.top)

dragapproved=true
document.onmousemove=drag_drop
}
}
document.onmouseup=new Function("dragapproved=false")

////drag drop functions end here//////

function updatepage_SCommnet(str,tot)
{
	if(str!="")
	{
		var totval=str.split(",");
		for(t=1;t<=totval.length;t++)
		{
			document.getElementById("spComment"+t).innerHTML=totval[t-1];
		}
	}
	//document.getElementById("tdSendMail").innerHTML=str;
}

function hidebox(){
	var pagename=GetPage();
	
	if(pagename=="shopchoice_details.php")
	{
		var totval=document.getElementById("totRecord").value;
		
		var scid=document.getElementById("hidScId").value;
		// For Total Comments on Shoprs' Choice/
		var xmlHttpReq_SCommnet = false;
		var self = this;
		// Mozilla/Safari
		if (window.XMLHttpRequest) {
			self.xmlHttpReq_SCommnet = new XMLHttpRequest();
		}
		// IE
		else if (window.ActiveXObject) {
			self.xmlHttpReq_SCommnet = new ActiveXObject("Microsoft.XMLHTTP");
		}
		//alert("view_totalcomment.php?scid="+scid);
		self.xmlHttpReq_SCommnet.open('POST',"view_totalcomment.php?scid="+scid, true);
		self.xmlHttpReq_SCommnet.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		
		self.xmlHttpReq_SCommnet.onreadystatechange = function() 
		{	
			if (self.xmlHttpReq_SCommnet.readyState == 4) {
				updatepage_SCommnet(self.xmlHttpReq_SCommnet.responseText,totval);
			}
		}
		self.xmlHttpReq_SCommnet.send(null);
		// End of Comments
		
		// Get All Comments
			GetShopChoiceAllComments(scid,totval);
		
	}
	
	if(pagename=="promotion.php" || pagename=="promotion_listing.php"  || pagename=="shopchoice_listing.php" || pagename=="promotion_details.php" || pagename=="search_result.php" || pagename=="marketplace.php" || pagename=="marketplace_listing.php" || pagename=="marketplace_details.php" || pagename=="shoplist.php" || pagename=="shoplist_listing.php" || pagename=="shoplist_details.php" || pagename=="shoplist_details_map.php" || pagename=="review_details.php" || pagename=="shopchoice_details.php")
	{
		document.getElementById("ifmTest").src="blank.php";	
	}
	
crossobj=ns6? document.getElementById("showimage") : document.all.showimage

if (ie4||ns6)
	crossobj.style.visibility="hidden"
else if (ns4)
	document.showimage.visibility="hide"
}


// Get Shopchoice All Comments//
function GetShopChoiceAllComments(scid,totval)
{
	var xmlHttpReq_scComment = false;
		var self = this;
		// Mozilla/Safari
		if (window.XMLHttpRequest) {
			self.xmlHttpReq_scComment = new XMLHttpRequest();
		}
		// IE
		else if (window.ActiveXObject) {
			self.xmlHttpReq_scComment = new ActiveXObject("Microsoft.XMLHTTP");
		}
		self.xmlHttpReq_scComment.open('POST',"view_allcomment.php?scid="+scid, true);
		self.xmlHttpReq_scComment.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		
		self.xmlHttpReq_scComment.onreadystatechange = function() 
		{	
			if (self.xmlHttpReq_scComment.readyState == 4) {
				updatepage_scComment(self.xmlHttpReq_scComment.responseText,totval);
			}
		}
		self.xmlHttpReq_scComment.send(null);
		// End of Comments
}

function updatepage_scComment(str,tot)
{
	if(str!="")
	{
		var totval=str.split("#====#");
		for(t=1;t<=totval.length;t++)
		{
			document.getElementById("trComment"+t).innerHTML=totval[t-1];
		}
	}
}
// End of Get ShopChoice All Commmentes

function updatepage_SRating(str,tot)
{
	if(str!="")
	{
		var totval=str.split("@@");
		if(totval.length > 0)
		{
			var totlove=totval[0].split(",");
			var totthumb=totval[1].split(",");
			for(t=1;t<=totlove.length;t++)
			{
				document.getElementById("tdLove"+t).innerHTML=totlove[t-1];
				document.getElementById("tdThumb"+t).innerHTML=totthumb[t-1];
			}
		}
	}
}

function updatepage_PRating(str,tot)
{
	if(str!="")
	{
		document.getElementById("tdLove").innerHTML=str;
	}
}

function updatepage_PAllRating(str,tot)
{
	if(str!="")
	{
		//alert(str);
		var totval=str.split("@@");
		var totmostlove=totval[0].split(",");
		var totfealove=totval[1].split(",");
		for(t=1;t<=totmostlove.length;t++)
		{
			document.getElementById("spMostLove"+t).innerHTML=totmostlove[t-1];
		}
		for(f=1;f<=totfealove.length;f++)
		{
			document.getElementById("spFeaLove"+f).innerHTML=totfealove[f-1];
		}
	}
}


function updatepage_RAllRating(str,tot)
{
	if(str!="")
	{
		var totmostlove=str.split(",");

		for(t=1;t<=tot;t++)
		{
			document.getElementById("tdLove"+t).innerHTML=totmostlove[t-1];
		}
	}
}

// Hide Rating Message Box//
function hidebox_message(){
	
	var pagename=GetPage();
	if(pagename=="shopchoice_details.php")
	{
		var totval=document.getElementById("totRecord").value;
		var scid=document.getElementById("hidScId").value;
		// For Total Comments on Shoprs' Choice/
		var xmlHttpReq_SRating = false;
		var self = this;
		// Mozilla/Safari
		if (window.XMLHttpRequest) {
			self.xmlHttpReq_SRating = new XMLHttpRequest();
		}
		// IE
		else if (window.ActiveXObject) {
			self.xmlHttpReq_SRating = new ActiveXObject("Microsoft.XMLHTTP");
		}
		//alert("view_totalcomment.php?scid="+scid);
		var reqvar=GetQueryString();
		var val="";
		if(isNaN(reqvar))
		{
			val="&sortby="+reqvar;
		}
		self.xmlHttpReq_SRating.open('POST',"view_totalrating.php?scid="+scid+val, true);
		self.xmlHttpReq_SRating.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		
		self.xmlHttpReq_SRating.onreadystatechange = function() 
		{	
			if (self.xmlHttpReq_SRating.readyState == 4) {
				updatepage_SRating(self.xmlHttpReq_SRating.responseText,totval);
			}
		}
		self.xmlHttpReq_SRating.send(null);
	}
	else if(pagename=="promotion_details.php" || pagename=="marketplace_details.php" || pagename=="shoplist_details.php")
	{
		var pid=document.getElementById("hidPid").value;
		var flag="";
		if(pagename=="promotion_details.php")
		{
			flag="P";
		}
		else if(pagename=="marketplace_details.php")
		{
			flag="M";
		}
		else if(pagename=="shoplist_details.php" || pagename=="shoplist_details_map.php")
		{
			flag="S";
		}
		
		var xmlHttpReq_PRating = false;
		var self = this;
		// Mozilla/Safari
		if (window.XMLHttpRequest) {
			self.xmlHttpReq_PRating  = new XMLHttpRequest();
		}
		// IE
		else if (window.ActiveXObject) {
			self.xmlHttpReq_PRating  = new ActiveXObject("Microsoft.XMLHTTP");
		}
		//alert("view_rating.php?flag="+flag+"&pid="+pid);
		self.xmlHttpReq_PRating.open('POST',"view_rating.php?flag="+flag+"&pid="+pid, true);
		self.xmlHttpReq_PRating.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		
		self.xmlHttpReq_PRating.onreadystatechange = function() 
		{	
			if (self.xmlHttpReq_PRating.readyState == 4) {
				updatepage_PRating(self.xmlHttpReq_PRating.responseText,totval);
			}
		}
		self.xmlHttpReq_PRating.send(null);
	}
	else if(pagename=="promotion.php")
	{
		var xmlHttpReq_PAllRating = false;
		var self = this;
		// Mozilla/Safari
		if (window.XMLHttpRequest) {
			self.xmlHttpReq_PAllRating = new XMLHttpRequest();
		}
		// IE
		else if (window.ActiveXObject) {
			self.xmlHttpReq_PAllRating= new ActiveXObject("Microsoft.XMLHTTP");
		}
		//alert("view_totalcomment.php?scid="+scid);
		self.xmlHttpReq_PAllRating.open('POST',"view_promotionrating.php", true);
		self.xmlHttpReq_PAllRating.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		
		self.xmlHttpReq_PAllRating.onreadystatechange = function() 
		{	
			if (self.xmlHttpReq_PAllRating.readyState == 4) {
				updatepage_PAllRating(self.xmlHttpReq_PAllRating.responseText,totval);
			}
		}
		self.xmlHttpReq_PAllRating.send(null);
	}
	else if(pagename=="review_details.php")
	{
		var totval=document.getElementById("totRecord").value;
		var rid=document.getElementById("hidScId").value;
		
		
		var xmlHttpReq_RAllRating = false;
		var self = this;
		// Mozilla/Safari
		if (window.XMLHttpRequest) {
			self.xmlHttpReq_RAllRating = new XMLHttpRequest();
		}
		// IE
		else if (window.ActiveXObject) {
			self.xmlHttpReq_RAllRating= new ActiveXObject("Microsoft.XMLHTTP");
		}
		var tmpstart="0";
		if(GetQueryString_VarName()=="start")
		{
			tmpstart=GetQueryString();
		}
		
		var reqvar=GetQueryString();
		var val="";
		if(isNaN(reqvar))
		{
			val="&sortby="+reqvar;
		}
		
		//alert("view_totalcomment.php?scid="+scid);
		self.xmlHttpReq_RAllRating.open('POST',"view_reviewrating.php?rid="+rid+"&tmpstart="+tmpstart+val, true);
		self.xmlHttpReq_RAllRating.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		
		self.xmlHttpReq_RAllRating.onreadystatechange = function() 
		{	
			if (self.xmlHttpReq_RAllRating.readyState == 4) {
				updatepage_RAllRating(self.xmlHttpReq_RAllRating.responseText,totval);
			}
		}
		self.xmlHttpReq_RAllRating.send(null);
	}

crossobj=ns6? document.getElementById("showimage_message") : document.all.showimage_message

if (ie4||ns6)
	crossobj.style.visibility="hidden"
else if (ns4)
	document.showimage_message.visibility="hide"
}
// End of Hide Rating Message Box

// Hide Top Box
function hidebox_top(){

crossobj=ns6? document.getElementById("showimage_top") : document.all.showimage_top

if (ie4||ns6)
	crossobj.style.visibility="hidden"
else if (ns4)
	document.showimage_top.visibility="hide"
}


// Hide Top Box Details
function hidebox_message_details(){

document.getElementById("ifmTest_details").src="blank.php";

	var pagename=GetPage();
	if(pagename=="shopchoice_details.php")
	{
		var totval=document.getElementById("totRecord").value;
		var scid=document.getElementById("hidScId").value;
		// For Total Comments on Shoprs' Choice/
		var xmlHttpReq_SRating = false;
		var self = this;
		// Mozilla/Safari
		if (window.XMLHttpRequest) {
			self.xmlHttpReq_SRating = new XMLHttpRequest();
		}
		// IE
		else if (window.ActiveXObject) {
			self.xmlHttpReq_SRating = new ActiveXObject("Microsoft.XMLHTTP");
		}
		//alert("view_totalcomment.php?scid="+scid);
		var reqvar=GetQueryString();
		var val="";
		if(isNaN(reqvar))
		{
			val="&sortby="+reqvar;
		}
		self.xmlHttpReq_SRating.open('POST',"view_totalrating.php?scid="+scid+val, true);
		self.xmlHttpReq_SRating.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		
		self.xmlHttpReq_SRating.onreadystatechange = function() 
		{	
			if (self.xmlHttpReq_SRating.readyState == 4) {
				updatepage_SRating(self.xmlHttpReq_SRating.responseText,totval);
			}
		}
		self.xmlHttpReq_SRating.send(null);
	}
	else if(pagename=="promotion_details.php" || pagename=="marketplace_details.php" || pagename=="shoplist_details.php")
	{
		var pid=document.getElementById("hidPid").value;
		var flag="";
		if(pagename=="promotion_details.php")
		{
			flag="P";
		}
		else if(pagename=="marketplace_details.php")
		{
			flag="M";
		}
		else if(pagename=="shoplist_details.php" || pagename=="shoplist_details_map.php")
		{
			flag="S";
		}
		
		var xmlHttpReq_PRating = false;
		var self = this;
		// Mozilla/Safari
		if (window.XMLHttpRequest) {
			self.xmlHttpReq_PRating  = new XMLHttpRequest();
		}
		// IE
		else if (window.ActiveXObject) {
			self.xmlHttpReq_PRating  = new ActiveXObject("Microsoft.XMLHTTP");
		}
		//alert("view_rating.php?flag="+flag+"&pid="+pid);
		self.xmlHttpReq_PRating.open('POST',"view_rating.php?flag="+flag+"&pid="+pid, true);
		self.xmlHttpReq_PRating.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		
		self.xmlHttpReq_PRating.onreadystatechange = function() 
		{	
			if (self.xmlHttpReq_PRating.readyState == 4) {
				updatepage_PRating(self.xmlHttpReq_PRating.responseText,1);
			}
		}
		self.xmlHttpReq_PRating.send(null);
	}
	else if(pagename=="promotion.php")
	{
		var xmlHttpReq_PAllRating = false;
		var self = this;
		// Mozilla/Safari
		if (window.XMLHttpRequest) {
			self.xmlHttpReq_PAllRating = new XMLHttpRequest();
		}
		// IE
		else if (window.ActiveXObject) {
			self.xmlHttpReq_PAllRating= new ActiveXObject("Microsoft.XMLHTTP");
		}
		//alert("view_totalcomment.php?scid="+scid);
		self.xmlHttpReq_PAllRating.open('POST',"view_promotionrating.php", true);
		self.xmlHttpReq_PAllRating.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		
		self.xmlHttpReq_PAllRating.onreadystatechange = function() 
		{	
			if (self.xmlHttpReq_PAllRating.readyState == 4) {
				updatepage_PAllRating(self.xmlHttpReq_PAllRating.responseText,totval);
			}
		}
		self.xmlHttpReq_PAllRating.send(null);
	}
	else if(pagename=="review_details.php")
	{
		var totval=document.getElementById("totRecord").value;
		var rid=document.getElementById("hidScId").value;
		
		
		var xmlHttpReq_RAllRating = false;
		var self = this;
		// Mozilla/Safari
		if (window.XMLHttpRequest) {
			self.xmlHttpReq_RAllRating = new XMLHttpRequest();
		}
		// IE
		else if (window.ActiveXObject) {
			self.xmlHttpReq_RAllRating= new ActiveXObject("Microsoft.XMLHTTP");
		}
		var tmpstart="0";
		if(GetQueryString_VarName()=="start")
		{
			tmpstart=GetQueryString();
		}
		
		var reqvar=GetQueryString();
		var val="";
		if(isNaN(reqvar))
		{
			val="&sortby="+reqvar;
		}
		
		//alert("view_totalcomment.php?scid="+scid);
		self.xmlHttpReq_RAllRating.open('POST',"view_reviewrating.php?rid="+rid+"&tmpstart="+tmpstart+val, true);
		self.xmlHttpReq_RAllRating.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		
		self.xmlHttpReq_RAllRating.onreadystatechange = function() 
		{	
			if (self.xmlHttpReq_RAllRating.readyState == 4) {
				updatepage_RAllRating(self.xmlHttpReq_RAllRating.responseText,totval);
			}
		}
		self.xmlHttpReq_RAllRating.send(null);
	}

crossobj=ns6? document.getElementById("showimage_message_details") : document.all.showimage_message_details

if (ie4||ns6)
	crossobj.style.visibility="hidden"
else if (ns4)
	document.showimage_message_details.visibility="hide"
}

function frmShow()
{
	document.getElementById("showimage").style.display="inline";
	
}

function frmShow_promo(val,ptype,pagename_new,inputObj)
{	
	var newtoppos=0;
	var pagename=GetPage();
	if(pagename=="promotion_details.php" || pagename=="marketplace_details.php" || pagename=="shoplist_details.php" )
	{
		newtoppos=getTopPos(inputObj)-300;
	}
	else
	{
		newtoppos=getTopPos(inputObj)-375;
	}
	var LeftPosition = (screen.width/2)-(500/2);
	
	document.getElementById("showimage").style.left = LeftPosition + 'px';
	document.getElementById("showimage").style.top = newtoppos + 'px';
	
	crossobj=ns6? document.getElementById("showimage") : document.all.showimage
	
	if (ie4||ns6)
		crossobj.style.visibility="visible"
	else if (ns4)
		document.showimage.visibility="visible"

	
	document.getElementById("ifmTest").src="blank.php";
	
	if(ptype=="M")//M=mail button
	{
		document.getElementById("ifmTest").src="small_mail.php?pid="+val+"&pgname="+pagename_new;
		//document.getElementById("spTitle").innerHTML="Send to Friend";
	}
	else if(ptype=="R")//R=report button
	{
		document.getElementById("ifmTest").src="small_report.php?pid="+val+"&pgname="+pagename_new;
		//document.getElementById("spTitle").innerHTML="Report";
	}
	else if(ptype=="C")//C=Shop Choice Commments
	{
		document.getElementById("ifmTest").src="shopchoice_comment.php?nid="+val+"&pgname="+pagename_new;
		//document.getElementById("spTitle").innerHTML="Report";
	}
	document.getElementById("showimage").style.display="inline";

}

// Reviews Review//
function frmShow_Review(val,ptype,pagename)
{	
	crossobj=ns6? document.getElementById("showimage") : document.all.showimage
	
	if (ie4||ns6)
		crossobj.style.visibility="visible"
	else if (ns4)
		document.showimage.visibility="visible"

	document.getElementById("ifmTest").src="blank.php";
	
	if(ptype=="R")//M=mail button
	{
		document.getElementById("ifmTest").src="review_comment.php?rid="+val+"&pgname="+pagename;
	}
	
	document.getElementById("showimage").style.display="inline";
}
// End of Reviews Review

// Rating Function
function frmshow_Message_AJAX(pid,uid,ptype,pagename,inputObj)
{
	/*if(uid=="")
	{
		//alert("Please Login to submit Rating");
		crossobj=ns6? document.getElementById("showimage_message") : document.all.showimage_message

			if (ie4||ns6)
				crossobj.style.visibility="visible"
			else if (ns4)
				document.showimage_message.visibility="visible"

			document.getElementById("tdPreview_message").innerHTML='Please login to show your <img src="images/red_cross3.jpg" title="Love it!" width="17" height="12" border="0">';
			
			document.getElementById("showimage_message").style.display="inline";
	}
	else 
	{*/
		var xmlHttpReq_Message = false;
		var self = this;
		// Mozilla/Safari
		if (window.XMLHttpRequest) {
			self.xmlHttpReq_Message = new XMLHttpRequest();
		}
		// IE
		else if (window.ActiveXObject) {
			self.xmlHttpReq_Message = new ActiveXObject("Microsoft.XMLHTTP");
		}
		//alert("rating.php?pid="+pid+"&uid="+uid+"&ptype="+ptype);
		self.xmlHttpReq_Message.open('POST', "rating.php?pid="+pid+"&uid="+uid+"&ptype="+ptype, true);
		self.xmlHttpReq_Message.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		var tempmsg="";
		self.xmlHttpReq_Message.onreadystatechange = function() 
		{	
			if (self.xmlHttpReq_Message.readyState == 4) {
				//alert(self.xmlHttpReq_Message.responseText);
				tempmsg=self.xmlHttpReq_Message.responseText;
				
				if(tempmsg!="")
				{
					var newtoppos=getTopPos(inputObj)-75;
					var LeftPosition = (screen.width/2)-(300/2);
					
					
					var pagename=GetPage();
					if(pagename=="promotion_details.php" || pagename=="shoplist_details_map.php"  || pagename=="marketplace_details.php")
					{
						document.getElementById("showimage_message_details").style.left = LeftPosition + 'px';
						document.getElementById("showimage_message_details").style.top = newtoppos + 'px';
						
						crossobj=ns6? document.getElementById("showimage_message_details") : document.all.showimage_message_details
			
						if (ie4||ns6)
							crossobj.style.visibility="visible"
						else if (ns4)
							document.showimage_message_details.visibility="visible"
			
						document.getElementById("ifmTest_details").src="top_message.php?str="+tempmsg;
						
						document.getElementById("showimage_message_details").style.display="inline";
					}
					else
					{
						document.getElementById("showimage_message").style.left = LeftPosition + 'px';
						document.getElementById("showimage_message").style.top = newtoppos + 'px';
						
						crossobj=ns6? document.getElementById("showimage_message") : document.all.showimage_message
		
						if (ie4||ns6)
							crossobj.style.visibility="visible"
						else if (ns4)
							document.showimage_message.visibility="visible"
		
						if(tempmsg=="Y")
							document.getElementById("tdPreview_message").innerHTML="Thanks for your <img src='images/red_cross3.jpg' border='0'> !";
						else if(tempmsg=="N")
							document.getElementById("tdPreview_message").innerHTML="Sorry, you can only <img src='images/red_cross3.jpg' border='0'> once";
						else if(tempmsg=="L")
							document.getElementById("tdPreview_message").innerHTML='Please login to show your <img src="images/red_cross3.jpg" title="Love it!" width="17" height="12" border="0">';
					
						document.getElementById("showimage_message").style.display="inline";
					}
				}
			}
		}
		self.xmlHttpReq_Message.send(null);
	//}
}
//End of Rating Function

// Rating Function
function frmshow_Message_AJAXNO(pid,uid,ptype,pagename)
{
	/*if(uid=="")
	{
		//alert("Please Login to submit Rating");
		crossobj=ns6? document.getElementById("showimage_message") : document.all.showimage_message

			if (ie4||ns6)
				crossobj.style.visibility="visible"
			else if (ns4)
				document.showimage_message.visibility="visible"

			document.getElementById("tdPreview_message").innerHTML="Please Login to Submit Rating";
			
			document.getElementById("showimage_message").style.display="inline";
	}
	else 
	{*/
		var xmlHttpReq_Message_No = false;
		var self = this;
		// Mozilla/Safari
		if (window.XMLHttpRequest) {
			self.xmlHttpReq_Message_No = new XMLHttpRequest();
		}
		// IE
		else if (window.ActiveXObject) {
			self.xmlHttpReq_Message_No = new ActiveXObject("Microsoft.XMLHTTP");
		}
		
		self.xmlHttpReq_Message_No.open('POST', "shop_rating.php?pid="+pid+"&uid="+uid+"&ptype="+ptype, true);
		self.xmlHttpReq_Message_No.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		var tempmsg="";
		self.xmlHttpReq_Message_No.onreadystatechange = function() 
		{	
			if (self.xmlHttpReq_Message_No.readyState == 4) {
				//alert(self.xmlHttpReq_Message.responseText);
				tempmsg=self.xmlHttpReq_Message_No.responseText;
				
				if(tempmsg!="")
				{
					crossobj=ns6? document.getElementById("showimage_message") : document.all.showimage_message
	
					if (ie4||ns6)
						crossobj.style.visibility="visible"
					else if (ns4)
						document.showimage_message.visibility="visible"
	
					if(tempmsg=="Y")
						document.getElementById("tdPreview_message").innerHTML="Thanks for your <img src='images/red_cross7.jpg' border='0'> !";
					else if(tempmsg=="N")
						document.getElementById("tdPreview_message").innerHTML="Sorry, you can only <img src='images/red_cross7.jpg' border='0'> once";
					else if(tempmsg=="L")
						document.getElementById("tdPreview_message").innerHTML='Please login to show your <img src="images/red_cross3.jpg" title="Love it!" width="17" height="12" border="0">';
				
					document.getElementById("showimage_message").style.display="inline";
				}
			}
		}
		self.xmlHttpReq_Message_No.send(null);
	//}
}
//End of Rating Function


// Wishlist Function
function frmshow_WIshlist_AJAX(rid,uid,ptype)
{
	/*if(uid=="")
	{
		//alert("Please Login to submit Rating");
		crossobj=ns6? document.getElementById("showimage_message") : document.all.showimage_message

			if (ie4||ns6)
				crossobj.style.visibility="visible"
			else if (ns4)
				document.showimage_message.visibility="visible"

			document.getElementById("tdPreview_message").innerHTML="Please Login to Submit Rating";
			
			document.getElementById("showimage_message").style.display="inline";
	}
	else*/ 
	{
		var xmlHttpReq_Wishlist = false;
		var self = this;
		// Mozilla/Safari
		if (window.XMLHttpRequest) {
			self.xmlHttpReq_Wishlist = new XMLHttpRequest();
		}
		// IE
		else if (window.ActiveXObject) {
			self.xmlHttpReq_Wishlist = new ActiveXObject("Microsoft.XMLHTTP");
		}
		
		self.xmlHttpReq_Wishlist.open('POST', "wishlist.php?rid="+rid+"&ptype="+ptype, true);
		self.xmlHttpReq_Wishlist.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		var tempmsg="";
		self.xmlHttpReq_Wishlist.onreadystatechange = function() 
		{	
			if (self.xmlHttpReq_Wishlist.readyState == 4) {
				//alert(self.xmlHttpReq_Message.responseText);
				tempmsg=self.xmlHttpReq_Wishlist.responseText;
				
				if(tempmsg!="")
				{
					/*crossobj=ns6? document.getElementById("showimage_message") : document.all.showimage_message
	
					if (ie4||ns6)
						crossobj.style.visibility="visible"
					else if (ns4)
						document.showimage_message.visibility="visible"
	
					if(tempmsg=="Y")
						document.getElementById("tdPreview_message").innerHTML="Success! <br> This item has been successfully added to your wishlist.";
					else if(tempmsg=="N")
						document.getElementById("tdPreview_message").innerHTML="This item is already on your wishlist";
					else if(tempmsg=="U")
						document.getElementById("tdPreview_message").innerHTML="Please login to add this review on your wishlist";
				
					document.getElementById("showimage_message").style.display="inline";*/
					crossobj=ns6? document.getElementById("showimage_message_details") : document.all.showimage_message_details
	
					if (ie4||ns6)
						crossobj.style.visibility="visible"
					else if (ns4)
						document.showimage_message_details.visibility="visible"
		
					if(tempmsg=="Y")
						document.getElementById("ifmTest_details").src="top_message.php?str=Success! <br> This item has been successfully added to your wishlist.";
					else if(tempmsg=="N")
						document.getElementById("ifmTest_details").src="top_message.php?str=This item is already on your wishlist.";
					else if(tempmsg=="U")
						document.getElementById("ifmTest_details").src="top_message.php?str=Please login to add this review on your wishlist.";
					
					document.getElementById("showimage_message_details").style.display="inline";
				}
			}
		}
		self.xmlHttpReq_Wishlist.send(null);
	}
}
//End of Wishlist Function

function frmShowForm(mid,ftype,uid)
{
	crossobj=ns6? document.getElementById("showimage") : document.all.showimage

	if (ie4||ns6)
		crossobj.style.visibility="visible"
	else if (ns4)
		document.showimage.visibility="visible"
		
	document.getElementById("ifmTest").src="seller_mail.php?pid="+mid+"&ftype="+ftype+"&uid="+uid;
	//document.getElementById("spTitle").innerHTML="";	
	document.getElementById("showimage").style.display="inline";	
}

// Show Top Search Box//
function frmShopTopBox(inputObj)
{
	var newpos=getleftPos(inputObj)-60;
	document.getElementById("showimage_top").style.left = newpos + 'px';
	
	/*if(screen.width==1280 && (screen.height==600 || screen.height==720 || screen.height==768 || screen.height==960 || screen.height==1024))
	{
		document.getElementById("showimage_top").style.left="975px";
	}
	else if(screen.width==1152 && screen.height==864)
	{
		document.getElementById("showimage_top").style.left="915px";
	}*/

	crossobj=ns6? document.getElementById("showimage_top") : document.all.showimage_top

	if (ie4||ns6)
		crossobj.style.visibility="visible"
	else if (ns4)
		document.showimage_top.visibility="visible"
		
	//document.getElementById("ifmTopBox").src="topsearchbox.php";
	frmVal="<form name=\"frmSearch\" id=\"frmSearch\" method=\"post\" enctype=\"multipart/form-data\"><input type=\"checkbox\" onClick=\"frmMerge(this.value);\" id=\"chkSearch1\" name=\"chkSearch1\" value=\"Promotion\">&nbsp;Promotion<Br><input type=\"checkbox\" onClick=\"frmMerge(this.value);\" id=\"chkSearch2\" name=\"chkSearch2\" value=\"MarketPlace\">&nbsp;MarketPlace<Br><input type=\"checkbox\" onClick=\"frmMerge(this.value);\" id=\"chkSearch3\" name=\"chkSearch3\" value=\"Shoprslist\">&nbsp;ShOprs' Lists<br><input type=\"checkbox\" onClick=\"frmMerge(this.value);\" id=\"chkSearch4\" name=\"chkSearch4\" value=\"Shoprschoice\">&nbsp;ShOprs' Choice<br><input type=\"checkbox\" onClick=\"frmMerge(this.value);\" id=\"chkSearch5\" name=\"chkSearch5\" value=\"Reviews\">&nbsp;Reviews<br><input type=\"checkbox\" onClick=\"frmMerge(this.value);\" id=\"chkSearch6\" name=\"chkSearch6\" value=\"All\" checked=\"checked\">&nbsp;All<br><Br><a href='#' class='grey12-link1' onClick='frmTopSubmit();'>Search</a>&nbsp;&nbsp;<a href='#' class='grey12-link1' onClick='hidebox_top();return false'>Close</a></form>";
	
	document.getElementById("tdPreview_top").innerHTML=frmVal;
	document.getElementById("showimage_top").style.display="inline";
}
// End of Top Search Box//


// Show Credit Requirement Box//
function frmShopBox(val,cval1,cval2,cval3,cval4,cval5,cval6,cval7,cval8,cval9,cval10,inputObj)
{
		
	var csel1="";
	var csel2="";
	var csel3="";
	var csel4="";
	var csel5="";
	var csel6="";
	var csel7="";
	var csel8="";
	var csel9="";
	var csel10="";
	document.getElementById("showimage_topbox").style.top = getTopPos(inputObj) + 'px';
	
	var tmpval=document.getElementById("ddCreditCard").value;
	var tmpsplitval=tmpval.split(",");
	if(tmpsplitval.length >= 1)
	{
		for(v=0;v<tmpsplitval.length;v++)
		{
			if(tmpsplitval[v]=="ABN AMRO")
			{
				csel1="checked";
			}
			else if(tmpsplitval[v]=="AMEX")
			{
				csel2="checked";
			}
			else if(tmpsplitval[v]=="Citibank")
			{
				csel3="checked";
			}
			else if(tmpsplitval[v]=="Diners Club")
			{
				csel4="checked";
			}
			else if(tmpsplitval[v]=="DBS / POSB")
			{
				csel5="checked";
			}
			else if(tmpsplitval[v]=="HSBC")
			{
				csel6="checked";
			}
			else if(tmpsplitval[v]=="Maybank")
			{
				csel7="checked";
			}
			else if(tmpsplitval[v]=="OCBC")
			{
				csel8="checked";
			}
			else if(tmpsplitval[v]=="StanChart")
			{
				csel9="checked";
			}
			else if(tmpsplitval[v]=="UOB")
			{
				csel10="checked";
			}
		}
	}
	
	document.getElementById("showimage_topbox").style.left = getleftPos(inputObj) + 'px';
	
	crossobj=ns6? document.getElementById("showimage_topbox") : document.all.showimage_topbox

	if (ie4||ns6)
		crossobj.style.visibility="visible";
	else if (ns4)
		document.showimage_topbox.visibility="visible";
	
	if(cval1=="1")
	{
		csel1="checked";
	}
	if(cval2=="1")
	{
		csel2="checked";
	}
	if(cval3=="1")
	{
		csel3="checked";
	}
	if(cval4=="1")
	{
		csel4="checked";
	}
	if(cval5=="1")
	{
		csel5="checked";
	}
	if(cval6=="1")
	{
		csel6="checked";
	}
	if(cval7=="1")
	{
		csel7="checked";
	}
	if(cval8=="1")
	{
		csel8="checked";
	}
	if(cval9=="1")
	{
		csel9="checked";
	}
	if(cval10=="1")
	{
		csel10="checked";
	}
	
	frmVal_Credit="<form name=\"frmSearchbox\" id=\"frmSearchbox\" method=\"post\" enctype=\"multipart/form-data\"><input type=\"checkbox\"" + csel1 + " onClick=\"frmMerge_box(this.value,'Credit');\" id=\"boxchkSearch1\" name=\"boxchkSearch1\" value=\"ABN AMRO\">&nbsp;ABN AMRO<Br>";
	frmVal_Credit+="<input type=\"checkbox\"" + csel2 + " onClick=\"frmMerge_box(this.value,'Credit');\" id=\"boxchkSearch1\" name=\"boxchkSearch1\" value=\"AMEX\">&nbsp;AMEX<Br>";
	frmVal_Credit+="<input type=\"checkbox\"" + csel3 + " onClick=\"frmMerge_box(this.value,'Credit');\" id=\"boxchkSearch1\" name=\"boxchkSearch1\" value=\"Citibank\">&nbsp;Citibank<Br>";
	frmVal_Credit+="<input type=\"checkbox\"" + csel4 + " onClick=\"frmMerge_box(this.value,'Credit');\" id=\"boxchkSearch1\" name=\"boxchkSearch1\" value=\"Diners Club\">&nbsp;Diners Club<Br>";
	frmVal_Credit+="<input type=\"checkbox\"" + csel5 + " onClick=\"frmMerge_box(this.value,'Credit');\" id=\"boxchkSearch1\" name=\"boxchkSearch1\" value=\"DBS / POSB\">&nbsp;DBS /POSB<Br>";
	frmVal_Credit+="<input type=\"checkbox\"" + csel6 + " onClick=\"frmMerge_box(this.value,'Credit');\" id=\"boxchkSearch1\" name=\"boxchkSearch1\" value=\"HSBC\">&nbsp;HSBC<Br>";
	frmVal_Credit+="<input type=\"checkbox\"" + csel7 + " onClick=\"frmMerge_box(this.value,'Credit');\" id=\"boxchkSearch1\" name=\"boxchkSearch1\" value=\"Maybank\">&nbsp;Maybank<Br>";
	frmVal_Credit+="<input type=\"checkbox\"" + csel8 + " onClick=\"frmMerge_box(this.value,'Credit');\" id=\"boxchkSearch2\" name=\"boxchkSearch2\" value=\"OCBC\">&nbsp;OCBC<Br>";
	frmVal_Credit+="<input type=\"checkbox\"" + csel9 + " onClick=\"frmMerge_box(this.value,'Credit');\" id=\"boxchkSearch3\" name=\"boxchkSearch3\" value=\"StanChart\">&nbsp;StanChart<Br>";
	frmVal_Credit+="<input type=\"checkbox\"" + csel10 + " onClick=\"frmMerge_box(this.value,'Credit');\" id=\"boxchkSearch1\" name=\"boxchkSearch1\" value=\"UOB\">&nbsp;UOB<Br>&nbsp;&nbsp;<a href='#' class='grey12-link1' onClick=\"select_topbox('Credit');return false;\">Deselect All</a>&nbsp;&nbsp;<a href='#' class='grey12-link1' onClick='hidebox_topbox();return false'>Close</a></form>";
	
	document.getElementById("tdPreview_topbox").innerHTML=frmVal_Credit;
	document.getElementById("showimage_topbox").style.display="inline";
}
// End of Credit Requirement Box//

// Show Debit Requirement Box//
function frmShopBox_Debit(val,inputObj,cval4,cval5,cval6)
{
	document.getElementById("showimage_topbox").style.top = getTopPos(inputObj) + 'px';
	document.getElementById("showimage_topbox").style.left = getleftPos(inputObj) + 'px';
	
	/*if(screen.width==1280 && (screen.height==600 || screen.height==720 || screen.height==768 || screen.height==960 || screen.height==1024))
	{
		document.getElementById("showimage_topbox").style.left="402px";
	}
	else if(screen.width==1152 && screen.height==864)
	{
		document.getElementById("showimage_topbox").style.left="340px";
	}*/
	
	crossobj=ns6? document.getElementById("showimage_topbox") : document.all.showimage_topbox

	if (ie4||ns6)
		crossobj.style.visibility="visible"
	else if (ns4)
		document.showimage_topbox.visibility="visible"
		
	
	var csel4="";
	var csel5="";
	var csel6="";
	
	/*var tmpval=document.getElementById("ddDebitCard").value;
	var tmpsplitval=tmpval.split(",");
	if(tmpsplitval.length >= 1)
	{
		for(v=0;v<tmpsplitval.length;v++)
		{
			if(tmpsplitval[v]=="UOB")
			{
				csel4="checked";
			}
			else if(tmpsplitval[v]=="DBS")
			{
				csel5="checked";
			}
			else if(tmpsplitval[v]=="Card")
			{
				csel6="checked";
			}
		}
	}*/
	
	if(cval4=="1")
	{
		csel4="checked";
	}
	if(cval5=="1")
	{
		csel5="checked";
	}
	if(cval6=="1")
	{
		csel6="checked";
	}
	
	frmVal_debit="<form name=\"frmSearchbox_debit\" id=\"frmSearchbox_debit\" method=\"post\" enctype=\"multipart/form-data\"><input type=\"checkbox\"" + csel4 + " onClick=\"frmMerge_box(this.value,'Debit');\" id=\"boxchkSearch_debit1\" name=\"boxchkSearch_debit1\" value=\"UOB\">&nbsp;UOB<Br><input type=\"checkbox\"" + csel5 + " onClick=\"frmMerge_box(this.value,'Debit');\" id=\"boxchkSearch_debit2\" name=\"boxchkSearch_debit2\" value=\"DBS\">&nbsp;DBS<Br><input type=\"checkbox\"" + csel6 + " onClick=\"frmMerge_box(this.value,'Debit');\" id=\"boxchkSearch_debit3\" name=\"boxchkSearch_debit3\" value=\"Card\">&nbsp;Card<Br>&nbsp;&nbsp;<a href='#' class='grey12-link1' onClick=\"select_topbox('Debit');return false;\">Deselect All</a>&nbsp;&nbsp;<a href='#' class='grey12-link1' onClick='hidebox_topbox();return false'>Close</a></form>";
	
	document.getElementById("tdPreview_topbox").innerHTML=frmVal_debit;
	document.getElementById("showimage_topbox").style.display="inline";
}
// End of Debit Requirement Box//

// Hide Top Box
function hidebox_topbox(){

crossobj=ns6? document.getElementById("showimage_topbox") : document.all.showimage_topbox

if (ie4||ns6)
	crossobj.style.visibility="hidden"
else if (ns4)
	document.showimage_topbox.visibility="hide"
}

function frmMerge_box(val,ctype)
{
	newval1_box="";
	var name_box;
	
	if(ctype=="Credit")
	{
		name_box=document.getElementById("frmSearchbox");
	}
	else if(ctype=="Debit") 
	{
		name_box=document.getElementById("frmSearchbox_debit");
	}
		
	var flag_box="Y";
	var TotEle_box=name_box.elements.length;
	for(fi=0;fi<TotEle_box;fi++)
	{
		if(name_box.elements[fi].type=='checkbox')
		{
			if(name_box.elements[fi].checked==true)
			{
				newval1_box=newval1_box+name_box.elements[fi].value+", ";
			}
		}
	}
	
	finalval_box=newval1_box.substring(0,newval1_box.length-2);	
	
	if(ctype=="Credit")
	{
		document.getElementById("ddCreditCard").value=finalval_box;
		if(finalval_box=="")
		{
			document.getElementById("rdRequirement").checked=false;
		}
		else
		{
			document.getElementById("rdRequirement").checked=true;
		}
	}
	else if(ctype=="Debit")
	{
		//document.getElementById("ddDebitCard").value=finalval_box;
	}
}

function select_topbox(val)
{
	var name_box_val;
	document.getElementById("rdRequirement").checked=false;
	if(val=="Credit")
	{
		name_box_val=document.getElementById("frmSearchbox");
		document.getElementById("ddCreditCard").value="";
	}
	else if(val=="Debit")
	{
		name_box_val=document.getElementById("frmSearchbox_debit");
		//document.getElementById("ddDebitCard").value="";
	}
	
	var TotEle_box=name_box_val.elements.length;
	for(fi=0;fi<TotEle_box;fi++)
	{
		if(name_box_val.elements[fi].type=='checkbox')
		{
			name_box_val.elements[fi].checked=false;
		}
	}
}

function frmMerge(val)
{
	if(val=="All")
	{
		document.getElementById("chkSearch1").checked=false;
		document.getElementById("chkSearch2").checked=false;
		document.getElementById("chkSearch3").checked=false;
		document.getElementById("chkSearch4").checked=false;
		document.getElementById("chkSearch5").checked=false;
		document.getElementById("chkSearch6").checked=true;
	}
	else
	{
		document.getElementById("chkSearch6").checked=false;
	}
	
	newval1="";
	var name=document.getElementById("frmSearch");
	var flag="Y";
	var TotEle=name.elements.length;
	for(fi=0;fi<TotEle;fi++)
	{
		if(name.elements[fi].type=='checkbox')
		{
			if(name.elements[fi].checked==true)
			{
				newval1=newval1+name.elements[fi].value+",";
			}
		}
	}
	
	finalval=newval1.substring(0,newval1.length-1);	
	document.getElementById("hidTopSearch").value=finalval;
	document.getElementById("TopSubmit").value="1";
	//document.getElementById("frmTopSearch").submit();
	//document.frmTopSearch.submit();
}

function frmTopSubmit()
{
	if(document.getElementById("hidTopSearch").value=="")
	{
		document.getElementById("hidTopSearch").value="All";
		document.getElementById("TopSubmit").value="1";
	}

	document.frmTopSearch.submit();
}

function GetXmlHttpObject()
{ 
	var objXMLHttp=null
	if (window.XMLHttpRequest)
	{
		objXMLHttp=new XMLHttpRequest()
	}
	else if (window.ActiveXObject)
	{
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	return objXMLHttp
}

// End of Pop up box//

//function to escape typed characters to html entities
function escapeToHTML(text){
    while(text.indexOf("'")!=-1){
       text = text.replace("'","&#39;");
    }
    while(text.indexOf("(")!=-1){
       text = text.replace("(","&#40;");
    }
    while(text.indexOf(")")!=-1){
       text = text.replace(")","&#41;");
    }
    while(text.indexOf("\n")!=-1){
       text = text.replace("\n","<br />");
    }
	//getting rid of any script tags so people with nothing better to do won't mess me up...
	while(text.indexOf("script")!=-1){
       text = text.replace("script","sc.ript");
    }
	
    return text;
}

// For Display Left Category//
function ShowCat(val)
{
	for(l=0;l<document.getElementById("hidTotalLeft").value;l++)
	{
		if("leftcat"+l==val)
		{
			if(document.getElementById(val).style.display=="inline" || document.getElementById(val).style.display=="")
			{
				document.getElementById(val).style.display="none";
				document.getElementById("leftmain"+l).innerHTML="+";
			}
			else if(document.getElementById(val).style.display=="none")
			{
				document.getElementById(val).style.display="";
				document.getElementById("leftmain"+l).innerHTML="-&nbsp;";
			}
		}
		else
		{
			document.getElementById("leftcat"+l).style.display="none";
			if(document.getElementById("hidTotSubCat"+l).value>0)
			{
				document.getElementById("leftmain"+l).innerHTML="+";
			}
		}
	}
}

// end of Left Category

function popUpSmall(URL) {  // Small popUp
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=0,width=600,height=400,left=360,top=0');");
}


function StrReplace(fval,rval,str)
{
	var strReplaceAll = str;
	var intIndexOfMatch = strReplaceAll.indexOf(fval);
 
	// Loop over the string value replacing out each matching
	// substring.
	while (intIndexOfMatch != -1){
		// Relace out the current instance.
		strReplaceAll = strReplaceAll.replace(fval, rval )
 		// Get the index of any next matching substring.
		intIndexOfMatch = strReplaceAll.indexOf( fval );
	}
	return strReplaceAll;
}

////////////////////////// Search Result //////////////////
// Function for Search Result Prmotion //
function xmlhttpPost_Result(strURL,t,val) {
	
    var xmlHttpReq1 = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq1 = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq1 = new ActiveXObject("Microsoft.XMLHTTP");
    }

	self.xmlHttpReq1.open('POST', strURL, true);
    self.xmlHttpReq1.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    
	self.xmlHttpReq1.onreadystatechange = function() 
    {	
		if(t==11)
			progresspage_Result();
		
		if (self.xmlHttpReq1.readyState == 4) {
			//alert(self.xmlHttpReq.responseText);
            updatepage_Result(self.xmlHttpReq1.responseText,t);
        }
    }
    self.xmlHttpReq1.send(null);
}
// End of Function for Search Result//

function progresspage_Result(FieldId,FieldType,FrmName)
{
	document.getElementById("tdPromotionResult").innerHTML = "<div align='center'> <img src='images/loading_small.gif' alt='Loading...' border='0'></div>";
}

function updatepage_Result(str,s)
{
	if(s==11)
	{
		if(document.getElementById("trNoResult").style.display=="" && trim(str)!="")
		{
			document.getElementById("trNoResult").style.display="none";
		}
		document.getElementById("tdPromotionResult").innerHTML= str;
	}
	
}
// End of Promotion/

// Start Market Place//
function xmlhttpPost_Market(strURL,t,val) {
	
    var xmlHttpReq2 = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq2 = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq2 = new ActiveXObject("Microsoft.XMLHTTP");
    }
	
	self.xmlHttpReq2.open('POST', strURL, true);
    self.xmlHttpReq2.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    
	self.xmlHttpReq2.onreadystatechange = function() 
    {	
		if(t==12)
			progresspage_Market();
		
		if (self.xmlHttpReq2.readyState == 4) {
			//alert(self.xmlHttpReq.responseText);
            updatepage_Market(self.xmlHttpReq2.responseText,t);
        }
    }
    self.xmlHttpReq2.send(null);
}
// End of Function for Search Result//

function progresspage_Market()
{
	document.getElementById("tdMarketPlaceResult").innerHTML = "<div align='center'> <img src='images/loading_small.gif' alt='Loading...' border='0'></div>";
}

function updatepage_Market(str,s)
{
	if(s==12)
	{
		if(document.getElementById("trNoResult").style.display=="" && trim(str)!="")
		{
			document.getElementById("trNoResult").style.display="none";
		}
		document.getElementById("tdMarketPlaceResult").innerHTML= str;
	}
}
// End of Market Place


// Start Search of ShopList//

function xmlhttpPost_Shoplist(strURL,t,val) {
	
    var xmlHttpReq_shoplist = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq_shoplist = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq_shoplist = new ActiveXObject("Microsoft.XMLHTTP");
    }
	
	self.xmlHttpReq_shoplist.open('POST', strURL, true);
    self.xmlHttpReq_shoplist.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    
	self.xmlHttpReq_shoplist.onreadystatechange = function() 
    {	
		if(t==1)
			progresspage_Shoplist();
		
		if (self.xmlHttpReq_shoplist.readyState == 4) {
			//alert(self.xmlHttpReq_shoplist.responseText);
            updatepage_Shoplist(self.xmlHttpReq_shoplist.responseText,t);
        }
    }
    self.xmlHttpReq_shoplist.send(null);
}
// End of Function for Search Result//

function progresspage_Shoplist()
{
	document.getElementById("tdShoprsList").innerHTML = "<div align='center'> <img src='images/loading_small.gif' alt='Loading...' border='0'></div>";
}

function updatepage_Shoplist(str,s)
{
	if(s==1)
	{
		if(document.getElementById("trNoResult").style.display=="" && trim(str)!="")
		{
			document.getElementById("trNoResult").style.display="none";
		}
		document.getElementById("tdShoprsList").innerHTML= str;
	}
}
// End of SHoplist Place


// Start Search of Shopchoice//

function xmlhttpPost_Shopchoice(strURL,t,val) {
	
    var xmlHttpReq_shopchoice = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq_shopchoice = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq_shopchoice = new ActiveXObject("Microsoft.XMLHTTP");
    }
	
	self.xmlHttpReq_shopchoice.open('POST', strURL, true);
    self.xmlHttpReq_shopchoice.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    
	self.xmlHttpReq_shopchoice.onreadystatechange = function() 
    {	
		if(t==1)
			progresspage_ShopChoice();
		
		if (self.xmlHttpReq_shopchoice.readyState == 4) {
			//alert(self.xmlHttpReq_shopchoice.responseText);
            updatepage_ShopChoice(self.xmlHttpReq_shopchoice.responseText,t);
        }
    }
    self.xmlHttpReq_shopchoice.send(null);
}
// End of Function for Search Result//

function progresspage_ShopChoice()
{
	document.getElementById("tdShopChoice").innerHTML = "<div align='center'> <img src='images/loading_small.gif' alt='Loading...' border='0'></div>";
}

function updatepage_ShopChoice(str,s)
{
	if(s==1)
	{
		if(document.getElementById("trNoResult").style.display=="" && trim(str)!="")
		{
			document.getElementById("trNoResult").style.display="none";
		}
		document.getElementById("tdShopChoice").innerHTML= str;
	}
}
// End of Shopchoice Place

// Start Search of Review//
function xmlhttpPost_Review(strURL,t,val) {
	
    document.getElementById("trNoResult").style.display="none";
	var xmlHttpReq_review = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq_review = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq_review= new ActiveXObject("Microsoft.XMLHTTP");
    }
	
	self.xmlHttpReq_review.open('POST', strURL, true);
    self.xmlHttpReq_review.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    
	self.xmlHttpReq_review.onreadystatechange = function() 
    {	
		if(t==1)
			progresspage_Review();
		
		if (self.xmlHttpReq_review.readyState == 4) {
			//alert(self.xmlHttpReq.responseText);
            updatepage_Review(self.xmlHttpReq_review.responseText,t);
        }
    }
    self.xmlHttpReq_review.send(null);
}
// End of Function for Search Result//

function progresspage_Review()
{
	document.getElementById("tdReviewList").innerHTML = "<div align='center'> <img src='images/loading_small.gif' alt='Loading...' border='0'></div>";
}

function trim(s) 
{ 
    var l=0; var r=s.length -1; 
    while(l < s.length && s[l] == ' ') 
    {     l++; } 
    while(r > l && s[r] == ' ') 
    {     r-=1;     } 
    return s.substring(l, r+1); 
} 

function updatepage_Review(str,s)
{
	//alert(trim(str) + "==>" + s);
	//alert(str+"==>" + s);
	document.getElementById("trNoResult").style.display="none";
	/*alert(" P " + document.getElementById("tdPromotionResult").innerHTML);
	alert(" M " + document.getElementById("tdMarketPlaceResult").innerHTML);
	alert(" S " + document.getElementById("tdShoprsList").innerHTML);
	alert(" SC " + document.getElementById("tdShopChoice").innerHTML);
	alert(" RV " + str);*/
	
	if(document.getElementById("tdPromotionResult").innerHTML=='<div align="center"> <img src="images/loading_small.gif" alt="Loading..." border="0"></div>')
	{
		document.getElementById("tdPromotionResult").innerHTML="";
	}
	
	if(document.getElementById("tdMarketPlaceResult").innerHTML=='<div align="center"> <img src="images/loading_small.gif" alt="Loading..." border="0"></div>')
	{
		document.getElementById("tdMarketPlaceResult").innerHTML="";
	}
	
	if(document.getElementById("tdShoprsList").innerHTML=='<div align="center"> <img src="images/loading_small.gif" alt="Loading..." border="0"></div>')
	{
		document.getElementById("tdShoprsList").innerHTML="";
	}
	
	if(document.getElementById("tdShopChoice").innerHTML=='<div align="center"> <img src="images/loading_small.gif" alt="Loading..." border="0"></div>')
	{
		document.getElementById("tdShopChoice").innerHTML="";
	}
	
	
	update_noresult(str,s);
	/*alert(" P " + document.getElementById("tdPromotionResult").innerHTML);
	alert(" M " + document.getElementById("tdMarketPlaceResult").innerHTML);
	alert(" S " + document.getElementById("tdShoprsList").innerHTML);
	alert(" SC " + document.getElementById("tdShopChoice").innerHTML);
	alert(" RV " + str+"==>" + s + "==>" + document.getElementById("trNoResult").style.display);*/
}
// End of Review

function update_noresult(str,s)
{
//	alert(str + "==>" + s);
	if((document.getElementById("tdPromotionResult").innerHTML=="" || document.getElementById("tdPromotionResult").innerHTML=='<div align="center"> <img src="images/loading_small.gif" alt="Loading..." border="0"></div>') && (document.getElementById("tdMarketPlaceResult").innerHTML=="" || document.getElementById("tdMarketPlaceResult").innerHTML=='<div align="center"> <img src="images/loading_small.gif" alt="Loading..." border="0"></div>') && (document.getElementById("tdShoprsList").innerHTML=="" || document.getElementById("tdShoprsList").innerHTML=='<div align="center"> <img src="images/loading_small.gif" alt="Loading..." border="0"></div>')  && (document.getElementById("tdShopChoice").innerHTML=="" || document.getElementById("tdShopChoice").innerHTML=='<div align="center"> <img src="images/loading_small.gif" alt="Loading..." border="0"></div>')  && (document.getElementById("tdReviewList").innerHTML=="") && (str.length <= 10))
	{
		document.getElementById("tdReviewList").innerHTML="";
		document.getElementById("trNoResult").style.display="block";
	}
	else if(s==1)
	{
		//alert(document.getElementById("tdPromotionResult").innerHTML + "==>" + document.getElementById("tdMarketPlaceResult").innerHTML + "==>" + document.getElementById("tdShoprsList").innerHTML + "==>" + document.getElementById("tdShopChoice").innerHTML + "==>" +  trim(str));
		if((document.getElementById("tdPromotionResult").innerHTML=="") && (document.getElementById("tdMarketPlaceResult").innerHTML=="") && (document.getElementById("tdShoprsList").innerHTML=="")  && (document.getElementById("tdShopChoice").innerHTML=="") && (str.length <= 10 || str==""))
		{
			document.getElementById("tdReviewList").innerHTML="";
			document.getElementById("trNoResult").style.display="block";
		}
		else
		{
			document.getElementById("trNoResult").style.display="none";
			document.getElementById("tdReviewList").innerHTML= str;
		}
	}
	
	//|| (document.getElementById("tdReviewList").innerHTML!='<div align="center"> <img src="images/loading_small.gif" alt="Loading..." border="0"></div>' && document.getElementById("tdReviewList").innerHTML!=""))
if((document.getElementById("tdPromotionResult").innerHTML!='<div align="center"> <img src="images/loading_small.gif" alt="Loading..." border="0"></div>' && document.getElementById("tdPromotionResult").innerHTML!="") || (document.getElementById("tdMarketPlaceResult").innerHTML!='<div align="center"> <img src="images/loading_small.gif" alt="Loading..." border="0"></div>' && document.getElementById("tdMarketPlaceResult").innerHTML!="") || (document.getElementById("tdShoprsList").innerHTML!='<div align="center"> <img src="images/loading_small.gif" alt="Loading..." border="0"></div>' && document.getElementById("tdShoprsList").innerHTML!="") || (document.getElementById("tdShopChoice").innerHTML!='<div align="center"> <img src="images/loading_small.gif" alt="Loading..." border="0"></div>' && document.getElementById("tdShopChoice").innerHTML!="")|| (document.getElementById("tdReviewList").innerHTML!='<div align="center"> <img src="images/loading_small.gif" alt="Loading..." border="0"></div>' && document.getElementById("tdReviewList").innerHTML!=""))
	{
		document.getElementById("trNoResult").style.display="none";
	}
	else
	{
		document.getElementById("trNoResult").style.display="";	
	}
}

///////////////// End of Search Result ///////////////////////////////////////

// Promotion Listing Page //

function xmlhttpPost_PromotionListing(strURL,t,val) {

	var xmlHttpReq_Promo = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq_Promo = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq_Promo = new ActiveXObject("Microsoft.XMLHTTP");
    }

	if(val>0)
	{
		val1="&start="+val;
	}
	else 
	{
		val1="&start=0";
	}
	//alert(strURL);
	self.xmlHttpReq_Promo.open('POST', strURL+val1, true);
    self.xmlHttpReq_Promo.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    
	self.xmlHttpReq_Promo.onreadystatechange = function() 
    {	
		if(t==1)
			progresspage_PromotionListing();
		
		if (self.xmlHttpReq_Promo.readyState == 4) {
			//alert(self.xmlHttpReq.responseText);
            updatepage_PromotionListing(self.xmlHttpReq_Promo.responseText,t);
        }
    }
    self.xmlHttpReq_Promo.send(null);
}
// End of Function for Search Result//

function progresspage_PromotionListing()
{
	document.getElementById("tdPromotionListing").innerHTML = "<div align='center'> <img src='images/loading_small.gif' alt='Loading...' border='0'></div>";
}

function updatepage_PromotionListing(str,s)
{
	if(s==1)
		document.getElementById("tdPromotionListing").innerHTML= str;
	
}
// End of Promotion Listing Page

// Marketplace Listing Page //
function xmlhttpPost_MarketListing(strURL,t,val) {
	
    var xmlHttpReq_Market = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq_Market = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq_Market = new ActiveXObject("Microsoft.XMLHTTP");
    }

	if(val>0)
	{
		val1="&start="+val;
	}
	else 
	{
		val1="&start=0";
	}

	self.xmlHttpReq_Market.open('POST', strURL+val1, true);
    self.xmlHttpReq_Market.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    
	self.xmlHttpReq_Market.onreadystatechange = function() 
    {	
		if(t==1)
			progresspage_MarketListing();
		
		if (self.xmlHttpReq_Market.readyState == 4) {
			//alert(self.xmlHttpReq.responseText);
            updatepage_MarketListing(self.xmlHttpReq_Market.responseText,t);
        }
    }
    self.xmlHttpReq_Market.send(null);
}


function progresspage_MarketListing()
{
	document.getElementById("tdMarketListing").innerHTML = "<div align='center'> <img src='images/loading_small.gif' alt='Loading...' border='0'></div>";
}

function updatepage_MarketListing(str,s)
{
	if(s==1)
		document.getElementById("tdMarketListing").innerHTML= str;
}
// End of Marketplace Listing Page


// Shoplist Listing Page //
function xmlhttpPost_ShopListListing(strURL,t,val) {
	
    var xmlHttpReq_shopresult = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq_shopresult = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq_shopresult = new ActiveXObject("Microsoft.XMLHTTP");
    }

	if(val>0)
	{
		val1="&start="+val;
	}
	else 
	{
		val1="&start=0";
	}
	//alert(strURL+val1);
	self.xmlHttpReq_shopresult.open('POST', strURL+val1, true);
    self.xmlHttpReq_shopresult.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    
	self.xmlHttpReq_shopresult.onreadystatechange = function() 
    {	
		if(t==1)
			progresspage_shopresultListing();
		
		if (self.xmlHttpReq_shopresult.readyState == 4) {
			//alert(self.xmlHttpReq.responseText);
            updatepage_shopresultListing(self.xmlHttpReq_shopresult.responseText,t);
        }
    }
    self.xmlHttpReq_shopresult.send(null);
}


function progresspage_shopresultListing()
{
	document.getElementById("tdShopListListing").innerHTML = "<div align='center'> <img src='images/loading_small.gif' alt='Loading...' border='0'></div>";
}

function updatepage_shopresultListing(str,s)
{
	if(s==1)
		document.getElementById("tdShopListListing").innerHTML= str;
}
// End of Shoplist Listing Page


// Review Listing Page //
function xmlhttpPost_ReviewListing(strURL,t,val) {
	
    var xmlHttpReq_Review = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq_Review = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq_Review = new ActiveXObject("Microsoft.XMLHTTP");
    }

	if(val>0)
	{
		val1="&start="+val;
	}
	else 
	{
		val1="&start=0";
	}

	self.xmlHttpReq_Review.open('POST', strURL+val1, true);
    self.xmlHttpReq_Review.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    
	self.xmlHttpReq_Review.onreadystatechange = function() 
    {	
		if(t==1)
			progresspage_ReviewListing();
		
		if (self.xmlHttpReq_Review.readyState == 4) {
			//alert(self.xmlHttpReq.responseText);
            updatepage_ReviewListing(self.xmlHttpReq_Review.responseText,t);
        }
    }
    self.xmlHttpReq_Review.send(null);
}
// End of Function for Search Result//

function progresspage_ReviewListing()
{
	document.getElementById("tdReviewListing").innerHTML = "<div align='center'> <img src='images/loading_small.gif' alt='Loading...' border='0'></div>";
}

function updatepage_ReviewListing(str,s)
{
	if(s==1)
		document.getElementById("tdReviewListing").innerHTML= str;
	
}
// End of Review Listing Page


// ShopChoice Listing Page //
function xmlhttpPost_ShopChoiceListing(strURL,t,val) {
	
    var xmlHttpReq_Choice = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq_Choice= new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq_Choice = new ActiveXObject("Microsoft.XMLHTTP");
    }

	if(val>0)
	{
		val1="&start="+val;
	}
	else 
	{
		val1="&start=0";
	}

	self.xmlHttpReq_Choice.open('POST', strURL+val1, true);
    self.xmlHttpReq_Choice.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    
	self.xmlHttpReq_Choice.onreadystatechange = function() 
    {	
		if(t==1)
			progresspage_ShopChoiceListing();
		
		if (self.xmlHttpReq_Choice.readyState == 4) {
			//alert(self.xmlHttpReq.responseText);
            updatepage_ShopChoiceListing(self.xmlHttpReq_Choice.responseText,t);
        }
    }
    self.xmlHttpReq_Choice.send(null);
}
// End of Function for Search Result//

function progresspage_ShopChoiceListing()
{
	document.getElementById("tdShopChoiceListing").innerHTML = "<div align='center'> <img src='images/loading_small.gif' alt='Loading...' border='0'></div>";
}

function updatepage_ShopChoiceListing(str,s)
{
	if(s==1)
		document.getElementById("tdShopChoiceListing").innerHTML= str;
	
}
// End of ShopChoice Listing Page

// End of Function for Search Result//
// Get Page Name//
function GetPage()
{
	var sPath = window.location.pathname;
	//var sPage = sPath.substring(sPath.lastIndexOf('\\') + 1);
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	return sPage ;
}
// End of Get Page Name


// Function for Outlet Delete //
function xmlhttpPost_outlet(strURL,t,val) {
	
    var xmlHttpReq_outlet = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq_outlet = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq_outlet = new ActiveXObject("Microsoft.XMLHTTP");
    }
	//alert( strURL+"&mtype="+val);
	self.xmlHttpReq_outlet.open('POST', strURL+"&mtype="+val, true);
    self.xmlHttpReq_outlet.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    
	self.xmlHttpReq_outlet.onreadystatechange = function() 
    {	
		if (self.xmlHttpReq_outlet.readyState == 4) {
			//alert(self.xmlHttpReq.responseText);
            updatepage_outlet(self.xmlHttpReq_outlet.responseText,t);
        }
    }
    self.xmlHttpReq_outlet.send(null);
}

function updatepage_outlet(str,s)
{
	
}
// End of Outlet 

// End of Function for Search Result//


// Function for Add Shoplist Comments //
function xmlhttpPost_ShoplistComments(strURL,t,val,ctype)
{
  	if(ctype=="Add")
	{
		if(document.getElementById("txtPrice").value=="")
		{
			alert("Please Enter Best Price");
			document.getElementById("txtPrice").focus();
			return false;
		}
		else if(document.getElementById("txtFrom").value=="")
		{
			alert("Please Enter From");
			document.getElementById("txtFrom").focus();
			return false;
		}
	}
		var xmlHttpReq_scomment = false;
		var self = this;
		// Mozilla/Safari
		if (window.XMLHttpRequest) {
			self.xmlHttpReq_scomment = new XMLHttpRequest();
		}
		// IE
		else if (window.ActiveXObject) {
			self.xmlHttpReq_scomment = new ActiveXObject("Microsoft.XMLHTTP");
		}
		
		from1=document.getElementById("txtFrom").value
		from_name=StrReplace("&","@amp",from1);
		
		location1=document.getElementById("txtLocation").value
		location_name=StrReplace("&","@amp",location1);
		
		remark1=document.getElementById("txtRemarks").value
		remark=StrReplace("&","@amp",remark1);
		
		//alert(strURL+"?price="+document.getElementById("txtPrice").value+"&from_name="+from_name+"&location="+location_name+"&remark="+remark+"&uid="+val+"&sid="+t);
		self.xmlHttpReq_scomment.open('POST', strURL+"?price="+document.getElementById("txtPrice").value+"&from_name="+from_name+"&location="+location_name+"&remark="+remark+"&sid="+t+"&ctype="+ctype, true);
		self.xmlHttpReq_scomment.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		
		self.xmlHttpReq_scomment.onreadystatechange = function() 
		{	
			if (self.xmlHttpReq_scomment.readyState == 4) {
				updatepage_ShoplistComments(self.xmlHttpReq_scomment.responseText,t);
			}
		}
		self.xmlHttpReq_scomment.send(null);
		GetShopListLowestPrice(t);
}

function updatepage_ShoplistComments(str,s)
{
	var totval=str.split("#====#");
	
	if(totval[1]=="N")
	{
		alert("Please Login to Add comment");
		return false;
	}
	else
	{
		document.getElementById("txtPrice").value="";
		document.getElementById("txtFrom").value="";
		document.getElementById("txtLocation").value="";
		document.getElementById("txtRemarks").value="";
	}
	
	document.getElementById("tdShopComments").innerHTML=totval[0];
	
	
}
// End of Add Shoplist Comments

// GetShoplist Lowest Price

function GetShopListLowestPrice(sid)
{
	var xmlHttpReq_slistprice = false;
	var self = this;
	// Mozilla/Safari
	if (window.XMLHttpRequest) {
		self.xmlHttpReq_slistprice = new XMLHttpRequest();
	}
	// IE
	else if (window.ActiveXObject) {
		self.xmlHttpReq_slistprice = new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	self.xmlHttpReq_slistprice.open('POST', "shoplist_price.php?sid="+sid, true);
	self.xmlHttpReq_slistprice.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	
	self.xmlHttpReq_slistprice.onreadystatechange = function() 
	{	
		if (self.xmlHttpReq_slistprice.readyState == 4) {
			document.getElementById("spShopListPrice").innerHTML=self.xmlHttpReq_slistprice.responseText;
		}
	}
	self.xmlHttpReq_slistprice.send(null);
}

// End of Get SHoplist Lowest Prie

// Get Reviews Result
function xmlhttpPost_ReviewSearch(strURL,t,val)
{
	if(t==106)
	{
		brand1=document.getElementById("brand").value;
		brand=StrReplace("&","@amp",brand1);
		
		title1=document.getElementById("title").value;
		title=StrReplace("&","@amp",title1);
		
		val1="&brand="+brand+"&title="+title;
	}
	
		var xmlHttpReq_sreview = false;
		var self = this;
		// Mozilla/Safari
		if (window.XMLHttpRequest) {
			self.xmlHttpReq_sreview = new XMLHttpRequest();
		}
		// IE
		else if (window.ActiveXObject) {
			self.xmlHttpReq_sreview = new ActiveXObject("Microsoft.XMLHTTP");
		}
		
		self.xmlHttpReq_sreview.open('POST', strURL+val1, true);
		self.xmlHttpReq_sreview.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		
		self.xmlHttpReq_sreview.onreadystatechange = function() 
		{	
			if(t==106)
				progresspage_ReviewSearch();
			
			if (self.xmlHttpReq_sreview.readyState == 4) {
				updatepage_ReviewSearch(self.xmlHttpReq_sreview.responseText,t);
			}
		}
		self.xmlHttpReq_sreview.send(null);
	
}

function progresspage_ReviewSearch()
{
	document.getElementById("tdReview").innerHTML = '<img src="images/loading_small.gif" border="0">';
}

function updatepage_ReviewSearch(str,s)
{
	document.getElementById("tdReview").innerHTML=str;
}
// End of Get Reviews Result

// Display Shop Choice Form //
function xmlhttpPost_ShowForm(strURL)
{
	var catname1=document.getElementById("cat_name").value;
	var catname=StrReplace("&","@amp",catname1);
		
		var xmlHttpReq_sForm = false;
		var self = this;
		// Mozilla/Safari
		if (window.XMLHttpRequest) {
			self.xmlHttpReq_sForm = new XMLHttpRequest();
		}
		// IE
		else if (window.ActiveXObject) {
			self.xmlHttpReq_sForm = new ActiveXObject("Microsoft.XMLHTTP");
		}
		
		self.xmlHttpReq_sForm.open('POST', strURL+"?catname="+catname, true);
		self.xmlHttpReq_sForm.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		
		self.xmlHttpReq_sForm.onreadystatechange = function() 
		{	
			
			if (self.xmlHttpReq_sForm.readyState == 4) {
				updatepage_ShowForm(self.xmlHttpReq_sForm.responseText);
			}
		}
		self.xmlHttpReq_sForm.send(null);
	
}


function updatepage_ShowForm(str)
{
	document.getElementById("tblSecond").innerHTML=str;
	document.getElementById("tblFirst").style.display="none";
}
// End of Display

//Display Shopchoice Coments//
// Display Shop Choice Form //
function xmlhttpPost_Comment(strURL,start,val)
{
		var xmlHttpReq_Display = false;
		var self = this;
		// Mozilla/Safari
		if (window.XMLHttpRequest) {
			self.xmlHttpReq_Display = new XMLHttpRequest();
		}
		// IE
		else if (window.ActiveXObject) {
			self.xmlHttpReq_Display = new ActiveXObject("Microsoft.XMLHTTP");
		}
		self.xmlHttpReq_Display.open('POST', strURL+"&val="+val+"&start="+start, true);
		self.xmlHttpReq_Display.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		
		self.xmlHttpReq_Display.onreadystatechange = function() 
		{	
			progresspage_Comment(val);
			if (self.xmlHttpReq_Display.readyState == 4) {
				updatepage_Comment(self.xmlHttpReq_Display.responseText,val);
			}
		}
		self.xmlHttpReq_Display.send(null);
}

function progresspage_Comment(s)
{
	document.getElementById("trComment"+s).innerHTML = '<img src="images/loading_small.gif" border="0">';
}

function updatepage_Comment(str,s)
{
	document.getElementById("trComment"+s).style.display="";
	document.getElementById("trComment"+s).innerHTML=str;
}
// End of Display SHopchoice Comments/


// Get Query String//
function GetQueryString()
{
	var query = window.location.search.substring(1);
	var vars = query.split("&");  
	for (var i=0;i<vars.length;i++) 
	{    
		var pair = vars[i].split("=");    
		return pair[1];    
	}   
}

function GetQueryString_VarName()
{
	var query = window.location.search.substring(1);
	var vars = query.split("&");  
	for (var i=0;i<vars.length;i++) 
	{    
		var pair = vars[i].split("=");    
		return pair[0];    
	}   
}

function GetQueryString_Second_var()
{
	var query = window.location.search.substring(1);
	var vars = query.split("&");  
	if(vars.length>1)
	{
		if(vars[1]!="undefined");
		{
			var pair = vars[1].split("=");    
			return pair[0];    
		}   
	}
}


function GetQueryString_Second_val()
{
	var query = window.location.search.substring(1);
	var vars = query.split("&");  
	if(vars.length>1)
	{
		if(vars[1]!="undefined");
		{
			var pair = vars[1].split("=");    
			return pair[1];    
		}
	}
}
// End of Get query String

// Get Browser//
function GetBrowser()
{
	// Mozilla/Safari
    if (window.ActiveXObject) {
		return "IE";
    }
	else if (window.XMLHttpRequest) {
      return "Safari";
    }
    // IE
    
	
}
// End of Get Browser


function getleftPos(inputObj)
{
  var returnValue = inputObj.offsetLeft;
  while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetLeft;
  return returnValue;
}

function getTopPos(inputObj)
{
	
  var returnValue = inputObj.offsetTop + inputObj.offsetHeight;
  while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetTop;
  return returnValue;
}

function CompareDates(str1,str2) 
{ 
   var dt1   = parseInt(str1.substring(0,2),10); 
   var mon1  = parseInt(str1.substring(3,5),10);
   var yr1   = parseInt(str1.substring(6,10),10); 
   var dt2   = parseInt(str2.substring(0,2),10); 
   var mon2  = parseInt(str2.substring(3,5),10); 
   var yr2   = parseInt(str2.substring(6,10),10); 
   var date1 = new Date(yr1, mon1, dt1); 
   var date2 = new Date(yr2, mon2, dt2); 

   if(date2 < date1)
   {
      //alert("To date cannot be greater than from date");
      return "1"; 
   } 
   else 
   { 
      return "0";
   } 
} 

function setphoto(url,mid,url2,wdth,hght)
{
	document.getElementById("photo_preview").src=url;
	document.getElementById("photo_preview").name=mid;

	url1=url2;
	wwdth=wdth;
	hhght=hght;
}

function setphoto_Review(url,mid,url2,wdth,hght)
{
	document.getElementById("photo_preview"+mid).src=url;
	document.getElementById("photo_preview"+mid).name=mid;

	url1=url2;
	wwdth=wdth;
	hhght=hght;
}

/*function Addmore()
{
	var count=document.getElementById("hidTotalMap").value;
	var tblmain;
	if(count=="")
	{
		count=0;
	}
	tblmain=document.getElementById("divMap").innerHTML;
	alert(tblmain);
	//tblmain+='<table width=100% border=0 cellspacing=0 cellpadding=0><tr><td width="190" height="28" class="tahoma12"><strong>Outlet Name </strong></td><td><input name="outletname'+(eval(count)+1)+'" id="outletname'+(eval(count)+1)+'" type="text" value="" size="40"></td></tr>';
	//tblmain+='<tr><td class="tahoma12"><strong>Outlet Address </strong></td><td><input name="address'+(eval(count)+1)+'" id="address'+(eval(count)+1)+'" type="text" value="" size="40"></td></tr></table><Br>';
	
	tblmain+='<table width=100% border=0 cellspacing=0 cellpadding=0><tr><td width="190" height="28" class="tahoma12"><strong>Outlet Name </strong></td><td><input name="outletname[]" id="outletname" type="text" value="" size="40"></td></tr>';
	tblmain+='<tr><td class="tahoma12"><strong>Outlet Address </strong></td><td><input name="address[]" id="address" type="text" value="" size="40"></td></tr></table><Br>';
	
	document.getElementById("divMap").innerHTML=tblmain;
	document.getElementById("hidTotalMap").value=eval(document.getElementById("hidTotalMap").value)+1;
}*/