function bhw(obj)
	{
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
   myWidth = document.body.clientWidth;
   myHeight = document.body.clientHeight;
  }
var h = window.pageYOffset ||
	document.body.scrollTop ||
    document.documentElement.scrollTop;
var hp = document.body.offsetHeight;

var intElemScrollHeight = document.getElementById('id_attribute_value').scrollHeight;
var totalheight= intElemScrollHeight+301;
var bwidth= myWidth-22;

	if(obj == 3)
	{
		document.getElementById('tableheight3').style.height=myHeight;
		document.getElementById('tableheight3').style.width=bwidth;
		document.getElementById('divheight3').style.height=h;
		document.getElementById('afterBuyOfferDetail').style.height=totalheight;
	
		ow=screen.width;
		if (ow >= 1024)
		{
			document.getElementById('resolution3').style.width="900px"
		}
		if (ow <= 800)
		{
			document.getElementById('resolution3').className="600px";
		}
	}
	else if(obj == 2)
	{
		document.getElementById('tableheight2').style.height=myHeight;
		document.getElementById('tableheight2').style.width=bwidth;
		document.getElementById('divheight2').style.height=h;
		document.getElementById('alerttab1').style.height=totalheight;
	}
	else if(obj == 1)
	{
		document.getElementById('tableheight').style.height=myHeight;
		document.getElementById('tableheight').style.width=bwidth;
		document.getElementById('divheight').style.height=h;
		document.getElementById('offerDetail').style.height=totalheight;
	
		ow=screen.width;
		if (ow >= 1024)
		{
			document.getElementById('resolution').style.width="900px"
		}
		if (ow <= 800)
		{
			document.getElementById('resolution').className="600px";
		}
	}
	else
	{
		document.getElementById('tableheight1').style.height=myHeight;
		document.getElementById('tableheight1').style.width=bwidth;
		document.getElementById('divheight1').style.height=h;
		document.getElementById('alerttab').style.height=totalheight;
	}
}

function show_alert(message)
{
  document.getElementById(message).style.display="block";
}


function show_alert_off(message)
{
  document.getElementById(message).style.display="none";
}


function ajaxFunction()
{
	var xmlHttp;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	return xmlHttp;
}

function showDetailDiv(rownum,switchstatus,page)
{

	var serial = rownum;
	var div = 'list'+serial;
	if(document.getElementById(div))
	{
		var total_offers = document.getElementById('total_offers').value;

		var reject = 0;
		var buy = 0;
		var offer ='';
		
		if (document.getElementById(div).style.display=="none")
		{
			buy = document.getElementById('buy'+serial).value;
			if(page == 'next')
			{
				for(var i=serial;i<=total_offers;i++)
				{
					if (document.getElementById(div).style.display=="none")
					{
						serial = serial+1;
					}
					else
					{
						break;
					}
					div = 'list'+serial;
				}
			}
			else if(page == 'prev')
			{
				for(var i=serial;i>0;i--)
				{
					if (document.getElementById(div).style.display=="none")
					{
						serial = serial-1;
					}
					else
					{
						break;
					}
					div = 'list'+serial;
				}
			}
			if(buy == 0)
			{
				reject = 1;
			}
		}
	}

	if(document.getElementById(div))
	{
		offer = document.getElementById('ofrid'+serial).value;
		var xmlHttp=ajaxFunction();
		if(xmlHttp)
		{
			xmlHttp.onreadystatechange=function()
			{
				if(switchstatus == 1)
				{
					if(xmlHttp.readyState==4)
					{
						document.getElementById('switchstatus').value = 1;
						document.getElementById('myLink').href="/cgi/eto-myportal-enqalert.mp?modid=MY&switchstatus=1";
						document.getElementById('myLink1').href="/cgi/eto-myportal-enqalert.mp?modid=MY&switchstatus=1";
						document.getElementById('myLink2').innerHTML='<DIV class="pbl_hover3n_off" ONMOUSEOVER="this.className=\'pbl_hover3n\'" ONMOUSEOUT="this.className=\'pbl_hover3n_off\'" onclick="javascript:show_alert_off(\'switchtab\');show_alert(\'all_listing\');showDetailDiv(1,0,\'next\');">Switch to Listing View</DIV>';
						document.getElementById('switch-offer').innerHTML = xmlHttp.responseText;
					}
					else
					{
						document.getElementById('switch-offer').innerHTML='<TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" BGCOLOR="#FFFFFF" ALIGN="CENTER" height="270"><TR><TD VALIGN="TOP" WIDTH="100%" class="pbl_top_detail"><BR><BR><BR><div style="font-size: 18px; font-family: arial; color: rgb(77, 77, 77);" align="center">Processing.....<BR><BR><img src="/new/gifs/loading2.gif"></div><BR></td></tr></table>';
					}
				}
				else
				{
					if(xmlHttp.readyState==4)
					{
						document.getElementById('switchstatus').value = 0;
						document.getElementById('switch-offer').innerHTML='';
						document.getElementById('myLink').href="/cgi/eto-myportal-enqalert.mp?modid=MY";
						document.getElementById('myLink1').href="/cgi/eto-myportal-enqalert.mp?modid=MY";
						document.getElementById('myLink2').innerHTML='<DIV class="pbl_hover3n_off" ONMOUSEOVER="this.className=\'pbl_hover3n\'" ONMOUSEOUT="this.className=\'pbl_hover3n_off\'" onclick="javascript:show_alert_off(\'all_listing\');show_alert(\'switchtab\');showDetailDiv(1,1,\'next\');">Switch to One by One View</DIV>';

						var temp =xmlHttp.responseText;
						var my_array=temp.split("::::");
						document.getElementById('pagination_top').innerHTML=my_array[0];
						document.getElementById('show_detail').innerHTML=my_array[1];
						document.getElementById('pagination_bottom').innerHTML=my_array[2];
	
						
					}
					else
					{
						document.getElementById('show_detail').innerHTML='<TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" BGCOLOR="#FFFFFF" ALIGN="CENTER" height="270"><TR><TD VALIGN="TOP" WIDTH="100%" class="pbl_top_detail"><BR><BR><BR><div style="font-size: 18px; font-family: arial; color: rgb(77, 77, 77);" align="center">Processing.....<BR><BR><img src="/new/gifs/loading2.gif"></div><BR></td></tr></table>';
					}
				}
			}
			var str="/cgi/eto-offer-fulldetail.mp?offer="+offer+"&serial="+serial+"&total_offers="+total_offers+"&switchstatus="+switchstatus+"&reject="+reject+"&buy="+buy;
	
			xmlHttp.open("GET",str,true);
			xmlHttp.send(null);
		}
	}
}

function showAfterBuyDetailDiv(serial,switchstatus,openwindow)
{
	var portal = parseInt(document.getElementById('portal').value);
	var offer = document.getElementById('ofrid'+serial).value;
	var total_offers = document.getElementById('total_offers').value;
	
	var xmlHttp=ajaxFunction();

	var div_display = '';
	if(openwindow == 2)
	{
		div_display='show_detail';
	}
	else if(switchstatus == 1)
	{
		div_display='switch-offer';
	}
	else
	{	
		div_display='buy-reject';
	}

	if(xmlHttp)
	{
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{
				var temp=xmlHttp.responseText;

				document.getElementById(div_display).innerHTML=temp;
				document.getElementById('buy'+serial).value = 1;

				getCurrentBalance();
			}
			else
			{
				document.getElementById(div_display).innerHTML='<TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" BGCOLOR="#FFFFFF" ALIGN="CENTER" height="250"><TR><TD VALIGN="TOP" WIDTH="100%" class="pbl_top_detail"><BR><BR><BR><div style="font-size: 18px; font-family: arial; color: rgb(77, 77, 77);" align="center">Processing.....<BR><BR><img src="/new/gifs/loading2.gif"></div><BR></td></tr></table>';
			}
		}

		var str="/cgi/eto-buy-reject.mp?modid=MY&offer="+offer+"&action=purchase&P="+portal+"&serial="+serial+"&switchstatus="+switchstatus+"&total_offers="+total_offers+"&openwindow="+openwindow;
		xmlHttp.open("GET",str,true);
		xmlHttp.send(null);
	}
}

function getCurrentBalance()
{
	var xmlHttp=ajaxFunction();
	if(xmlHttp)
	{
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{
				var current_balance =xmlHttp.responseText;
				document.getElementById('balance').value = current_balance;
				document.getElementById('current_balance').innerHTML = current_balance;

				var current_list = document.getElementById('current_list').value;
				current_list = current_list-1;
				document.getElementById('current_list').value =current_list;

				if(current_list == 0)
				{	
					document.getElementById('no_offer_msg').innerHTML = '<DIV CLASS="pbl-sr" align="center"><BR><B>You do not have any Buy Lead Alerts Available in your MY. <BR>Please Search with Product / Service Name to view more Buy Leads</B><BR><BR></DIV>';
				}
			}
		}
		var str="/cgi/eto-current-balance.pl";
		xmlHttp.open("GET",str,true);
		xmlHttp.send(null);
	}
}

function showBuyOfferDetail(serial,switchstatus)
{	
	var offer = document.getElementById('ofrid'+serial).value;
	var total_offers = document.getElementById('total_offers').value;

	var expired = document.getElementById('expired'+serial).value;
	//var switchstatus = document.getElementById('switchstatus').value;

	var xmlHttp=ajaxFunction();
	if(xmlHttp)
	{
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{
				var temp =xmlHttp.responseText;
				var my_array=temp.split("::::");

				if(switchstatus == 1)
				{
					document.getElementById('switchstatus').value = 1;
					document.getElementById('myLink').href="/cgi/eto-myportal-enqalert.mp?modid=MY&switchstatus=1";
					document.getElementById('myLink1').href="/cgi/eto-mypur-lead-view.mp?modid=MY&disp=D&switchstatus=1";

					document.getElementById('myLink2').innerHTML='<DIV class="pbl_hover3n_off" ONMOUSEOVER="this.className=\'pbl_hover3n\'" ONMOUSEOUT="this.className=\'pbl_hover3n_off\'" onclick="javascript:show_alert_off(\'switchDiv\');show_alert(\'all_listing\');changeSwitch(0);">Switch to Listing View</DIV>';

					document.getElementById('top-switch').innerHTML=my_array[0];
					document.getElementById('buy-switch').innerHTML=my_array[1];
					document.getElementById('bottom-switch').innerHTML=my_array[2];
				}
				else
				{	
					document.getElementById('top').innerHTML=my_array[0];
					document.getElementById('after-buy').innerHTML=my_array[1];
					document.getElementById('bottom').innerHTML=my_array[2];
				}
			}
			else
			{
				var processing_div = 'after-buy';
				if(switchstatus == 1)
				{
					processing_div = 'buy-switch';
				}
				document.getElementById(processing_div).innerHTML='<TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" BGCOLOR="#FFFFFF" ALIGN="CENTER" height="500"><TR><TD VALIGN="TOP" WIDTH="100%" class="pbl_top_detail"><BR><BR><BR><BR><BR><BR><BR><BR><div style="font-size: 18px; font-family: arial; color: rgb(77, 77, 77);" align="center">Processing.....<BR><BR><img src="/new/gifs/loading2.gif"></div><BR></td></tr></table>';
			}
		}

		var str="/cgi/eto-mypur-lead-view.mp?modid=MY&offer="+offer+"&newdisp=1&serial="+serial+"&switchstatus="+switchstatus+"&total_offers="+total_offers+"&expired="+expired;
		xmlHttp.open("GET",str,true);
		xmlHttp.send(null);
	}
}

function changeSwitch(switchstatus)
{
	if(switchstatus == 1){}
	else
	{
		document.getElementById('switchstatus').value = 0;
		document.getElementById('myLink').href="/cgi/eto-myportal-enqalert.mp?modid=MY";
		document.getElementById('myLink1').href="/cgi/eto-mypur-lead-view.mp?modid=MY&disp=D";
		document.getElementById('myLink2').innerHTML='<DIV class="pbl_hover3n_off" ONMOUSEOVER="this.className=\'pbl_hover3n\'" ONMOUSEOUT="this.className=\'pbl_hover3n_off\'" onclick="javascript:show_alert_off(\'all_listing\');show_alert(\'switchDiv\');showBuyOfferDetail(1,1);">Switch to One by One View</DIV>';
	}
}

function checkSearch(MyForm)
{
	MyForm.search.value = MyForm.search.value.replace(/^\s+/g, '').replace(/\s+$/g, '');

	if(MyForm.search.value.length < 3 || MyForm.search.value == "type here ...")
	{
		alert("Enter at least three characters for search.");
		MyForm.search.focus();
		return false;
	}
}

function showBuyRejectAlert(obj,serial,openwindow)
{
	var credit = parseInt(document.getElementById('ofrCredit'+serial).value);
	var offerID = document.getElementById('ofrid'+serial).value;
	var balance = parseInt(document.getElementById('balance').value);
	var portal = parseInt(document.getElementById('portal').value);
	var switchstatus = document.getElementById('switchstatus').value;


	var alerttab = 'alerttab';
	var buyreject = 'buy-reject';
	if(openwindow == 2)
	{
		alerttab = 'alerttab1';
		buyreject = 'buy-reject1';
	}

	if(obj == 'buy')
	{
		var str = '/cgi/eto-subscription.mp?modid=MY&offer='+offerID;
		if(balance < credit)
		{
			document.getElementById(buyreject).innerHTML = '<div class="pbl_alrt-prc" style="width:460px; height:115px;"><div class="pbl_alrt-txt"> You don\'t have sufficient credits to purchase this Buy Lead. <BR>Purchase more credits now!<BR><BR><table align="center" border="0" width="150"> <tbody><tr> <td class="pbl_yes-prc" ><input type="button" name="purchase" value="Purchase More Credits" onclick="javascript:window.location=\''+str+'\'"></td><td class="pbl_yes-prc" ><input type="button" name="close" value="Close" onclick="javascript:show_alert_off(\''+alerttab+'\');"></td></tr></tbody></table> </div></div>';
		}
		else
		{
			if(openwindow == 2 || switchstatus == 1)
			{
				document.getElementById(buyreject).innerHTML = '<div class="pbl_alrt-prc" style="width:340px; height:100px;"> <div class="pbl_alrt-txt"><b>This offer will cost <i> '+credit+' credits</i> only.</b><br><img src="/gifs/zero.gif" height="10" width="1"><br> <table align="center" border="0" width="150"><tbody><tr><td class="pbl_yes-prc" onclick="javascript:bhw(2);show_alert_off(\''+alerttab+'\');showAfterBuyDetailDiv(\''+serial+'\',\''+switchstatus+'\',\''+openwindow+'\');show_alert_off(\'list'+serial+'\');" align="center" width="57"><div class="pbl_yes-hover1_off" onmouseover="this.className=\'pbl_yes-hover1\'" onmouseout="this.className=\'pbl_yes-hover1_off\'">Buy</div></td> <td class="pbl_yes-prc" onclick="javascript:show_alert_off(\''+alerttab+'\')" align="center" width="57"> <div onmouseover="this.className=\'pbl_yes-hover1\'" onmouseout="this.className=\'pbl_yes-hover1_off\'" class="pbl_yes-hover1_off">Cancel</div></td> </tr></tbody></table></div></div>';
			}
			else
			{
				document.getElementById(buyreject).innerHTML = '<div class="pbl_alrt-prc" style="width:300px; height:90px;"> <div class="pbl_alrt-txt"><b>This offer will cost <i> '+credit+' credits </i>only.</b><br><img src="/gifs/zero.gif" height="10" width="1"><br> <table align="center" border="0" width="150"> <tbody><tr><td class="pbl_yes-prc" onclick="javascript:bhw(0);show_alert(\''+alerttab+'\');showAfterBuyDetailDiv(\''+serial+'\',\''+switchstatus+'\',\''+openwindow+'\');show_alert_off(\'list'+serial+'\');" align="center" width="57"><div class="pbl_yes-hover1_off" onmouseover="this.className=\'pbl_yes-hover1\'" onmouseout="this.className=\'pbl_yes-hover1_off\'">Buy</div></td> <td class="pbl_yes-prc" onclick="javascript:show_alert_off(\''+alerttab+'\')" align="center" width="57"> <div onmouseover="this.className=\'pbl_yes-hover1\'" onmouseout="this.className=\'pbl_yes-hover1_off\'" class="pbl_yes-hover1_off">Cancel</div></td> </tr></tbody></table></div></div>';
			}
		}	
	}
	else if(obj == 'reject')
	{
		/*for reject check*/
		var serial1 = serial +1;
		var div = 'list'+serial1;
		var getoffer = 0;
		if(document.getElementById(div))
		{
			if (document.getElementById(div).style.display=="none")
			{
				for(var i=serial1;i<=total_offers;i++)
				{
					if (document.getElementById(div).style.display=="block")
					{
						getoffer= 1;
						serial1= i;
						break;
					}
					div = 'list'+i;
				}
	
				if(getoffer == 0)
				{
					serial1 = serial-1;
					div = 'list'+serial1;
					for(var i=serial1;i>0;i--)
					{	
						if (document.getElementById(div).style.display=="block") 
						{	
							getoffer = 1;
							serial1 = i;
							break;
						}
						div = 'list'+i;
					}
				}
			}
		}
		else
		{
			serial1 = serial-1;
			div = 'list'+serial1;
			for(var i=serial1;i>0;i--)
			{
				if (document.getElementById(div).style.display=="block")
				{
					serial1 = i;
					break;
				}
				div = 'list'+i;
			}
		}
		div = 'list'+serial1;
		/*End for reject check*/
		
		
		var onclick = '';
		if(switchstatus == 1)
		{
			if (!document.getElementById(div) || document.getElementById(div).style.display=="none")
			{
				onclick = '<td class="pbl_yes-prc" onclick="javascript:actionBuyReject(\''+obj+'\',\''+serial+'\');show_alert_off(\'list'+serial+'\');show_alert_off(\''+alerttab+'\');show_alert_off(\'switchtab\');show_alert(\'all_listing\');showDetailDiv(1,0,\'next\');" align="center" width="57">';
			}
			else
			{
				onclick = '<td class="pbl_yes-prc" onclick="javascript:actionBuyReject(\''+obj+'\',\''+serial+'\');show_alert_off(\'list'+serial+'\');show_alert_off(\'switch_div'+serial+'\');showDetailDiv(\''+serial1+'\',1);show_alert_off(\''+alerttab+'\');" align="center" width="57">';
			}
		}
		else if(openwindow == 2)
		{
			if (!document.getElementById(div) || document.getElementById(div).style.display=="none")
			{
				onclick = '<td class="pbl_yes-prc" onclick="javascript:actionBuyReject(\''+obj+'\',\''+serial+'\');show_alert_off(\'list'+serial+'\');show_alert_off(\''+alerttab+'\');show_alert_off(\'offerDetail\');" align="center" width="57">';
			}
			else
			{
				onclick = '<td class="pbl_yes-prc" onclick="javascript:actionBuyReject(\''+obj+'\',\''+serial+'\');show_alert_off(\'list'+serial+'\');show_alert_off(\'switch_div'+serial+'\');showDetailDiv(\''+serial1+'\',0);show_alert_off(\''+alerttab+'\');" align="center" width="57">';
			}
		}
		
		if(openwindow == 2 || switchstatus == 1)
		{
			document.getElementById(buyreject).innerHTML = '<div class="pbl_alrt-prc" style="width:340px; height:130px;"> <div class="pbl_alrt-txt">Please note that Rejected Leads will stop appearing in the list of your Alerts.<BR>Reject anyway?</b><br><img src="/gifs/zero.gif" height="10" width="1"><br> <table align="center" border="0" width="150"> <tbody><tr>'+onclick+'<div class="pbl_yes-hover1_off" onmouseover="this.className=\'pbl_yes-hover1\'" onmouseout="this.className=\'pbl_yes-hover1_off\'">Yes</div></td><td class="pbl_yes-prc" onclick="javascript:show_alert_off(\''+alerttab+'\')" align="center" width="57"> <div onmouseover="this.className=\'pbl_yes-hover1\'" onmouseout="this.className=\'pbl_yes-hover1_off\'" class="pbl_yes-hover1_off">No</div></td> </tr></tbody></table></div></div>';
		}
		else
		{
			document.getElementById(buyreject).innerHTML = '<div class="pbl_alrt-prc" style="width:340px; height:120px;"> <div class="pbl_alrt-txt">Please note that Rejected Leads will stop appearing in the list of your Alerts.<BR>Reject anyway?</b><br><img src="/gifs/zero.gif" height="10" width="1"><br><table align="center" border="0" width="150"><tbody><tr> <td class="pbl_yes-prc" onclick="javascript:actionBuyReject(\''+obj+'\',\''+serial+'\');show_alert_off(\'list'+serial+'\');show_alert_off(\'alerttab\');" align="center" width="57"> <div class="pbl_yes-hover1_off" onmouseover="this.className=\'pbl_yes-hover1\'" onmouseout="this.className=\'pbl_yes-hover1_off\'">Yes</div></td> <td class="pbl_yes-prc" onclick="javascript:show_alert_off(\''+alerttab+'\')" align="center" width="57"> <div onmouseover="this.className=\'pbl_yes-hover1\'" onmouseout="this.className=\'pbl_yes-hover1_off\'" class="pbl_yes-hover1_off">No</div></td> </tr></tbody></table></div></div>';
		}
	}
}

function actionBuyReject(obj,serial)
{
	var offer = document.getElementById('ofrid'+serial).value;

	var xmlHttp=ajaxFunction();
	if(xmlHttp)
	{
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{
				var temp =xmlHttp.responseText;
				var current_list = document.getElementById('current_list').value;
				current_list = current_list-1;
				document.getElementById('current_list').value =current_list;

				//alert("CurrentLIst - "+current_list);
				if(current_list == 0)
				{
					document.getElementById('no_offer_msg').innerHTML='<DIV CLASS="pbl-sr" align="center"><BR><B>You do not have any Buy Lead Alerts Available in your MY. <BR>Please Search with Product / Service Name to view more Buy Leads</B><BR><BR></DIV>';
				}
			}
			else
			{
				document.getElementById('buy-reject').innerHTML='<div class="pbl_alrt-prc" style="width:340px; height:100px;"> <div class="pbl_alrt-txt"> <BR><BR><BR><div style="font-size: 18px; font-family: arial; color: rgb(77, 77, 77);" align="center">Processing.....<BR><BR><img src="/new/gifs/loading2.gif"></div></div></div>';
			}
		}
		var str="/cgi/eto-buy-reject.mp?modid=MY&offer="+offer+"&action=R";
		xmlHttp.open("GET",str,true);
		xmlHttp.send(null);
	}
}

function Response(obj,serial)
{
	var offerID = document.getElementById('ofrid'+serial).value;
	var MyForm = eval('document.'+obj);
	var switchstatus = document.getElementById('switchstatus').value;

	var expired=document.getElementById('expired'+serial).value;
	
	if(MyForm.mesg.value == '')
	{
		alert("Please fill your response");
		MyForm.mesg.focus();
		return false;
	}
	var divThankyou = 'divThankyou';
	if(switchstatus == 1)
	{
		divThankyou = 'divThankyou'+switchstatus;
	}

	var message = MyForm.mesg.value;
	var strlen = message.length;
	if(strlen > 2000)
	{
		alert("Your Response Message should not be more than 2000 characters")
		MyForm.mesg.focus();
		return false;
	}
//	message = message.substring(0, 2000);

	var sendmeCC='';
	if(MyForm.sendmeCC.checked == true)
	{
		sendmeCC='yes';
	}

	var xmlHttp=ajaxFunction();
	if(xmlHttp)
	{
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{
				var temp =xmlHttp.responseText;
				document.getElementById(divThankyou).innerHTML='<BR><BR><BR><BR><BR><div align="center" class="pbl_alrt-txt">'+temp+'</div><BR><BR><BR><BR><BR>';
				
				document.getElementById('thankyou'+serial).innerHTML='';
				document.getElementById('response1'+serial).innerHTML='Send Reminder';
				document.getElementById('response2'+serial).innerHTML='Send Reminder';
			}
			else
			{
				document.getElementById(divThankyou).innerHTML='<BR><BR><BR><BR><BR><div align="center"><img src="/new/gifs/loading2.gif"><BR><BR>Sending Response.....</div><BR><BR><BR><BR><BR><BR><BR>';
			}
		}
		var str="/cgi/eto-response.mp?response=1&popup=1&offerID="+offerID+"&mesg="+escape(message)+"&sendmeCC="+sendmeCC+"&encode=1&expired="+expired;
		
		xmlHttp.open("GET",str,true);
		xmlHttp.send(null);
	}
}

function sendOfferToMyMail(serial,ajax)
{
	var modid=document.getElementById('modid').value;
	var offer=document.getElementById('ofrid'+serial).value;
	var switchstatus = document.getElementById('switchstatus').value;

	var expired=document.getElementById('expired'+serial).value;

	if(ajax == 1)
	{
		var spanID = 'sendMail'+offer+ajax;
		if(switchstatus == 1)
		{
			spanID = 'sendMail'+offer+ajax+switchstatus;
		}
	}
	else
	{
		var spanID = 'sendMail'+offer;
	}

	var xmlHttp=ajaxFunction();
	if(xmlHttp)
	{
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{
				document.getElementById(spanID).innerHTML=xmlHttp.responseText;
				if(ajax == 1)
				{
					spanID = 'sendMail'+offer;
					document.getElementById(spanID).innerHTML=xmlHttp.responseText;
				}
			}
			else
			{
				document.getElementById(spanID).innerHTML='<img src=/gifs/indicator.gif>&nbsp;Sending Mail...';
			}
		}
		xmlHttp.open("GET","/cgi/eto-send-to-mymail.mp?offer="+offer+"&modid="+modid+"&expired="+expired,true);
		xmlHttp.send(null);
	}
}

function showAddressOfferDetail(serial,addresstotalbuy,address_start)
{	
	var switchstatus = 0;
	var total_offers = parseInt(addresstotalbuy);
	var buyerSerial = parseInt(serial);

	var address_start=parseInt(address_start);
	total_offers = total_offers + buyerSerial -1;

	var offer = document.getElementById('ofrid'+serial).value;
	var expired = document.getElementById('expired'+serial).value;

	var xmlHttp=ajaxFunction();
	if(xmlHttp)
	{
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{
				var temp =xmlHttp.responseText;
				var my_array=temp.split("::::");

				document.getElementById('top').innerHTML=my_array[0];
				document.getElementById('after-buy').innerHTML=my_array[1];
				document.getElementById('bottom').innerHTML=my_array[2];
			}
			else
			{
				document.getElementById('after-buy').innerHTML='<TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" BGCOLOR="#FFFFFF" ALIGN="CENTER" height="500"><TR><TD VALIGN="TOP" WIDTH="100%" class="pbl_top_detail"><BR><BR><BR><BR><BR><BR><BR><BR><div style="font-size: 18px; font-family: arial; color: rgb(77, 77, 77);" align="center">Processing.....<BR><BR><img src="/new/gifs/loading2.gif"></div><BR></td></tr></table>';
			}
		}
		var str="/cgi/eto-mypur-lead-view.mp?modid=MY&offer="+offer+"&newdisp=1&serial="+serial+"&switchstatus="+switchstatus+"&total_offers="+total_offers+"&address=1&addresstotalbuy="+addresstotalbuy+"&address_start="+address_start+"&expired="+expired;

		xmlHttp.open("GET",str,true);
		xmlHttp.send(null);
	}
}

/* Now serial is address div ID*/
function display_leads(serial,totalBuy)
{
	var already_open = document.getElementById('display_address').value;
	if(already_open == serial)
	{
		document.getElementById('div_response'+already_open).style.display="none";
		document.getElementById('display_address').value=0;
	}
	else
	{
		if(already_open != 0)
		{
			document.getElementById('div_response'+already_open).style.display="none";
		}
		document.getElementById('div_response'+serial).style.display="block";
		document.getElementById('display_address').value=serial;
	}
}

/* Glusr Registration Form Checking */

function check_count_change()
{
	var val = document.ModReg.country.options[document.ModReg.country.selectedIndex].value;
	if(val != document.ModReg.country_iso.value)
	{
		document.ModReg.city.value = '';
		document.ModReg.city_others.value = '';
		document.ModReg.state.value = '';
		document.ModReg.state_others.value = '';
		
		if(phonecode[document.ModReg.country.selectedIndex] != '')
		{
			document.ModReg.ph_country.value = phonecode[document.ModReg.country.selectedIndex];
		}
	}
	document.ModReg.country_iso.value = val;
	document.ModReg.country_name.value = document.ModReg.country.options[document.ModReg.country.selectedIndex].text;
}

function get_area()
{
	var xmlHttp=ajaxFunction();
	var city=document.getElementById("txtCity").value;
	if(xmlHttp)
	{
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{
			document.getElementById("txtArea").value=xmlHttp.responseText;
			}
		}
		xmlHttp.open("GET","GetAreaCode.mp?city="+escape(city),true);
		xmlHttp.send(null);
	}
}

/*
function updateContact(obj)
{
	document.getElementById('update').value=obj;
	if(obj==1)
	{
		
		var offer_company='';
		if(document.getElementById('company'))
		{
			offer_company = '<TR><TD class="pbl_cont" VALIGN="TOP"><B>Mobile</B></TD><TD class="pbl_cont" VALIGN="TOP">: </TD> <TD class="pbl_cont" VALIGN="TOP">'+document.getElementById('company').value+'</TD></TR>';
		}

		var offer_name = '<TR><TD class="pbl_cont" VALIGN="TOP"><B>Mobile</B></TD><TD class="pbl_cont" VALIGN="TOP">: </TD> <TD class="pbl_cont" VALIGN="TOP">'+document.getElementById('name').value+'</TD></TR>';
		
		if(document.getElementById('address'))
		{
			offer_address = '<TR><TD class="pbl_cont" VALIGN="TOP"><B>Mobile</B></TD><TD class="pbl_cont" VALIGN="TOP">: </TD> <TD class="pbl_cont" VALIGN="TOP">'+document.getElementById('address').value+'</TD></TR>';
		}
		
		var offer_city='';
		if(document.getElementById('city'))
		{
			offer_city = '<TR><TD class="pbl_cont" VALIGN="TOP"><B>Mobile</B></TD><TD class="pbl_cont" VALIGN="TOP">: </TD> <TD class="pbl_cont" VALIGN="TOP">'+document.getElementById('city').value+'</TD></TR>';
		}

		var offer_country_phone = '<TR><TD class="pbl_cont" VALIGN="TOP"><B>Mobile</B></TD><TD class="pbl_cont" VALIGN="TOP">: </TD> <TD class="pbl_cont" VALIGN="TOP">'+document.getElementById('country').value+'</TD></TR><TR><TD class="pbl_cont" VALIGN="TOP"><B>Mobile</B></TD><TD class="pbl_cont" VALIGN="TOP">: </TD> <TD class="pbl_cont" VALIGN="TOP">'+document.getElementById('phone').value+'</TD></TR>';

		var offer_fax ='';
		if(document.getElementById('fax'))
		{
			offer_fax = '<TR> <TD class="pbl_cont" VALIGN="TOP"><B>Mobile</B></TD> <TD class="pbl_cont" VALIGN="TOP">: </TD> <TD class="pbl_cont" VALIGN="TOP">'+document.getElementById('fax').value+'</TD></TR>';
		}

		var offer_mobile = '';
		if(document.getElementById('mobile'))
		{
			offer_mobile = '<TR><TD class="pbl_cont" VALIGN="TOP"><B>Mobile</B></TD> <TD class="pbl_cont" VALIGN="TOP">: </TD> <TD class="pbl_cont" VALIGN="TOP">'+document.getElementById('mobile').value+'</TD></TR>';
		}

		var offer_email = '<TR><TD class="pbl_cont" VALIGN="TOP"><B>Mobile</B></TD> <TD class="pbl_cont" VALIGN="TOP">: </TD> <TD class="pbl_cont" VALIGN="TOP">'+document.getElementById('email').value+'</TD></TR>';

		var offer_detail = '<DIV class="pbl_bdr1"><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0"> </TABLE></DIV>';

		var get_value = ''+offer_company+''+offer_name+''+offer_address;
		return false;
	}
}
*/

// Have to Implement

// new codes for new postofr form starts

function trim(sString)
{ 
	while (sString.substring(0,1) == ' ')
	{
	sString = sString.substring(1, sString.length);
	}
	while (sString.substring(sString.length-1, sString.length) == ' ')
	{
	sString = sString.substring(0,sString.length-1);
	}
	return sString;
}

function setCookie(name, value)
{
	expires = new Date();
	expires.setTime (expires.getTime() + 30 * 60 * 1000);

	if (value.length > 0)
 	document.cookie = name + "=" + escape(value)+ ";"+"path=/;"+"expires=" + expires.toGMTString()+";"
}

function getCookie(Name)
{
	var search = Name + "="
	if (document.cookie.length > 0)
	{ // if there are any cookies
		offset = document.cookie.indexOf(search)
		if (offset != -1)
		{ // if cookie exists
			offset += search.length
			// set index of beginning of value
			end = document.cookie.indexOf(";", offset)
			// set index of end of cookie value
			if (end == -1) end = document.cookie.length
			return unescape(document.cookie.substring(offset, end))
		}
	}
	return "";
}

function check_country_change(Form)
{
	var val = Form.country.options[Form.country.selectedIndex].value;
	if(val != Form.country_iso.value)
	{
		if((Form.city) && (Form.city_others))
		{
			Form.city.value = '';
			Form.city_others.value = '';
		}
		
		if((Form.state) && (Form.state_others))
		{
			Form.state.value = '';
			Form.state_others.value = '';
		}
		
		if(phonecode[Form.country.selectedIndex] != '')
		{
			Form.ph_country.value = phonecode[Form.country.selectedIndex];

			if(Form.fax_country)
			{
				Form.fax_country.value = phonecode[Form.country.selectedIndex];
			}
		}
	}
	Form.country_iso.value = val;
	Form.country_name.value = Form.country.options[Form.country.selectedIndex].text;
}

function assign_hidden_param_new(Form)
{
	if(Form.txtState_SelectedValue)
	{
		if(Form.txtState_SelectedValue.value != '')
		{
			Form.state_others.value=Form.txtState.value;
			Form.state.value=Form.txtState_SelectedValue.value;
		}
		else
		{
			Form.state_others.value=Form.txtState.value;
			Form.state.value='';
		}
	}
	
	if(Form.txtCity_SelectedValue)
	{
		if(Form.txtCity_SelectedValue.value != '')
		{
			Form.city_others.value=Form.txtCity.value;
			Form.city.value=Form.txtCity_SelectedValue.value;
		}
		else
		{
			Form.city_others.value=Form.txtCity.value;
			Form.city.value='';
		}
	}
	
	if(Form.usr_pass)
	{
		Form.usr_pass.value = Math.floor(Math.random()*9999)+100000;
	}
	
}

function Check_ModReg_New(Form)
{
	if(Form.name == "postForm" && document.getElementById('Radio1_B').checked == false)
	{
		alert("Please Select Offer Type First");
		document.getElementById('Radio1_B').focus();
		return false;
	}
	
	/* Trade offer feilds checking Starts... */
	if(trim(Form.title.value) == "") {
		if(Form.name=="postForm")
		{
			alert("Kindly enter Products / Services you are looking for.");
		}
		else
		{
			alert("Kindly enter Products / Services you want to Sell");
		}
		Form.title.focus();
		return false;
	}
	
	if(trim(Form.desc.value) == "" || trim(Form.desc.value) == "Please enter your buying requirements in detail. Provide key information like product specifications, estimated quantity etc." || trim(Form.desc.value) == "Please enter your selling requirements in detail. Provide key information like product specifications, estimated quantity etc.") {
		if(Form.name=="postForm")
		{
			alert("Kindly describe your Buying Requirements in detail.");
		}
		else
		{
			alert("Kindly describe your Products / Services in detail.");
		}
		Form.desc.focus();
		return false;
	}
// 	if(Form.desc.value.length > 1200) {
// 		alert("Your description should be less than 1200 charecters.");
// 		Form.desc.focus();
// 		return false;
// 	}

	if(Form.desc.value.length > 2000) {
		alert("Your description should be less than 2000 charecters.");
		Form.desc.focus();
		return false;
	}
	
	var radio_choice1 = false;
	var period_index;
	for (counter = 0; counter < Form.period.length; counter++)
	{
		if (Form.period[counter].checked)
		{
		radio_choice1 = true;
		period_index = counter;
		}
	}
	if (!radio_choice1)
	{
		if(Form.name=="postForm")
		{
			alert("Kindly select how soon you want to purchase.");
		}
		else
		{
			alert("Kindly select your Offer Validity.");
		}
		Form.period[0].focus();
		return false;
	}
	
	if(Form.category.value == "") {
		alert("Kindly select Category first.");
		//Form.category.focus();
		return false;
	}
		
	if(Form.frmsubmitbutton)
	{
		if(Form.frmsubmitbutton.value == 'newreg')
		{
			assign_hidden_param_new(Form); // setting the hidden parameters of states & cites ...
			
			if ((Form.website) && Form.website.value.length != 0)
			{
				if(Form.website.value.indexOf(" ") != -1)	{
				alert("Kindly enter correct URL without any spaces in it.");
				Form.website.focus();
				return false;
				}
				if(Form.website.value.indexOf("@") != -1)	{
				alert("Invalid Website ! Kindly enter correct website.");
				Form.website.focus();
				return false;
				}
				if(Form.website.value.indexOf(".") == -1)	{
				alert("Invalid Website ! Kindly enter correct website.");
				Form.website.focus();
				return false;
				}
				validarr = Form.website.value.split(".");
			
				if(validarr[0].length<2)   	{
				alert("Invalid Website ! Kindly enter correct website.");
				Form.website.focus();
				return false;
				}
				if(validarr[1].length<2)   	{
				alert("Invalid Website ! Kindly enter correct website.");
				Form.website.focus();
				return false;
				}
			}
			
			if((Form.first_name) && Form.first_name.value == "" ) {
				alert("Kindly enter your First Name.");
				Form.first_name.focus();
				return false;
			}
			
			if((Form.email) && Form.email.value == "" ) {
				alert("Kindly enter your E-mail ID.");
				Form.email.focus();
				return false;
			}
			else if ((Form.email) && Form.email.value.length != 0)
			{
		
				if(Form.email.value.indexOf(" ") != -1)	{
				alert("Kindly enter correct E-Mail ID without any spaces in it.");
				Form.email.focus();
				return false;
				}
			
				if(Form.email.value.indexOf("@") == -1)	{
				alert("Invalid E-Mail ID! Kindly enter correct E-Mail ID.");
				Form.email.focus();
				return false;
				}
				if(Form.email.value.indexOf(",") != -1)	{
				alert("Invalid E-Mail ID! Kindly enter correct E-Mail ID.");
				Form.email.focus();
				return false;
				}
				if(Form.email.value.indexOf(")") != -1)	{
				alert("Invalid E-Mail ID! Kindly enter correct E-Mail ID.");
				Form.email.focus();
				return false;
				}
				if(Form.email.value.indexOf("(") != -1)	{
				alert("Invalid E-Mail ID! Kindly enter correct E-Mail ID.");
				Form.email.focus();
				return false;
				}
				validarr = Form.email.value.split("@");
			
				if(validarr[0].length==0)   	{
				alert("Invalid E-Mail ID! Kindly enter the correct E-mail ID.");
				Form.email.focus();
				return false;
				}

				if(validarr[0].length != 0)   	{
				if(validarr[0].indexOf(".") != -1)     	{
				validemail = validarr[0].split(".");
				if(validemail[0].length<1)   		{
				alert("Invalid E-Mail ID! Kindly enter the correct E-mail ID.");
				Form.email.focus();
				return false;
				}
				if(validemail[1].length<1)  		{
				alert("Invalid E-Mail ID! Kindly enter the correct E-mail ID.");
				Form.email.focus();
				return false;
				}
				}
				}   // end of of validemail
				if(validarr[1].indexOf("@") >=0)   	{
				alert("Invalid E-Mail ID! Kindly enter the correct E-mail ID.");
				Form.email.focus();
				return false;
				}
				if(validarr[1].length==0)   	{
				alert("Invalid E-Mail ID! Kindly enter the correct E-mail ID.");
				Form.email.focus();
				return false;
				}
				if(validarr[1].length != 0)   	{
			
					if(validarr[1].indexOf(".") == -1)     	{
					alert("Invalid E-Mail ID! Kindly enter the correct E-mail ID.");
					Form.email.focus();
					return false;
					}
					validemail = validarr[1].split(".");
					if(validemail[0].length<1)   		{
					alert("Invalid E-Mail ID! Kindly enter the correct E-mail ID.");
					Form.email.focus();
					return false;
					}
					if(validemail[validemail.length-1].length<2)  		{
					alert("Invalid E-Mail ID! Kindly enter the correct E-mail ID.");
					Form.email.focus();
					return false;
					}
				}   // end of of validemail
			} // end of valid email-id check
			
			if((Form.country_name) && Form.country_name.value == "") {
				alert("Kindly select the Country.");
				//Form.country.focus();
				Form.country_name.focus();
				return false;
			}
			
			if((Form.ph_country) && Form.ph_country.value == "") {
				alert("Kindly enter country code for Telephone Number.");
				Form.ph_country.focus();
				return false;
			}
			else if((Form.ph_no) && Form.ph_no.value == "") {
				alert("Kindly enter your Telephone Number.");
				Form.ph_no.focus();
				return false;
			}
		
			//fax start
			if(Form.fax_country && Form.fax_country.value.length > 6) 
			{
				alert("Fax (Country Code) should not exceed 6 characters.");
				Form.fax_country.focus();
				return false;
			}
			if(Form.fax_area && Form.fax_area.value !='') 
			{
				if(isNaN(Form.fax_area.value))
				{
					alert("Fax (Area Code) should be an integer value.");
					Form.fax_area.focus();
					return false;
				}
		
				if(Form.fax_area.value.length > 6) 
				{
					alert("Fax (Area Code) should not exceed 6 characters.");
					Form.fax_area.focus();
					return false;
				}
			}
			
			if(Form.fax_no && Form.fax_no.value.length > 35) 
			{
				alert("Fax (Number) should not exceed 35 characters.");
				Form.fax_no.focus();
				return false;
			}
			//fax end
		
			if ((Form.first_name) && Form.first_name.value.length  > 20)
			{
				alert("First Name should not exceed 20 characters.");
				Form.first_name.focus();
				return false;
			}
			if ((Form.last_name) && Form.last_name.value.length  > 20)
			{
				alert("Last Name should not exceed 20 characters.");
				Form.last_name.focus();
				return false;
			}
			
			if((Form.email) && Form.email.value.length > 100)
			{
				alert("Email should not exceed 100 characters.");
				Form.email.focus();
				return false;
			}
			
			if((Form.country_name) && Form.country_name.value.length > 40) {
				alert("Country Name should not exceed 40 characters.");
				Form.country_name.focus();
				return false;
			}
			if((Form.ph_country) && Form.ph_country.value.length > 6) {
				alert("Telephone (Country Code) should not exceed 6 characters.");
				Form.ph_country.focus();
				return false;
			}
			/*
			if((Form.ph_area) && Form.ph_area.value !='') {
				if(isNaN(Form.ph_area.value))
				{
					alert("Telephone (Area Code) should be an integer value.");
					Form.ph_area.focus();
					return false;
				}
			}
			if((Form.ph_area) && Form.ph_area.value.length > 6) {
				alert("Telephone (Area Code) should not exceed 6 characters.");
				Form.ph_area.focus();
				return false;
			}
			*/
			if((Form.ph_no) && Form.ph_no.value.length > 35) {
				alert("Telephone (Number) should not exceed 35 characters.");
				Form.ph_no.focus();
				return false;
			}
			
			/* new ph & mob code */
			if((Form.ph_no) && (Form.mobile))
			{
				if (((Form.ph_no.value =='Phone Number') || (Form.ph_no.value.length == 0 )) && ((Form.mobile.value == 'Mobile Number') || (Form.mobile.value.length == 0)))
				{
					alert ("Kindly enter either Phone Number or Mobile Number.");
					Form.ph_no.focus();
					return false;
				}
					
				if(/^\s+$/.test(Form.ph_area.value))
				{
					alert ("Remove spaces from Phone (Area Code).");
					Form.ph_area.focus();
					return false;
				}
				
				if((/\s+/.test(Form.ph_no.value)) && (Form.ph_no.value != 'Phone Number'))
				{
					alert ("Remove spaces from Phone Number.");
					Form.ph_no.focus();
					return false;
				}
				
				if(!(/^\d+$/.test(Form.mobile.value)) && (Form.mobile.value != 'Mobile Number'))
				{
					alert ("Kindly enter numeric value in Mobile Number.");
					Form.mobile.focus();
					return false;
				}
			}
			/* new ph & mob code ends */

			if(Form.comp_name && Form.comp_name.value.length > 100) {
				alert("Company Name should not exceed 100 characters.");
				Form.comp_name.focus();
				return false;
			}
			
			if((Form.str_add1) && Form.str_add1.value.length > 60) {
				alert("Street Address should not exceed 60 characters.");
				Form.str_add1.focus();
				return false;
			}
			
			if((Form.mobile) && Form.mobile.value !='') {
				if(Form.mobile.value.length > 40) {
					alert("Your Mobile no. should not exceed 40 digits.");
					Form.mobile.focus();
					return false;
				}
// 				if(Form.mobile.value.length < 10) {
// 					alert("Your Mobile no. should be greater than 10 digits.");
// 					Form.mobile.focus();
// 					return false;
// 				}
			}
			
			if ((Form.captcha_text) && Form.captcha_text.value.length == 0)  {
					alert ("Kindly enter the code as appearing in the Image.");
					Form.captcha_text.focus();
					return false;
			}
		/*	
			if ((Form.terms) && !Form.terms.checked) {
				alert("You must agree to the Terms of Use for your registration.");
				Form.terms.focus();
				return false;
			}
		*/	
		}
		else if(Form.frmsubmitbutton.value == 'login')
		{
			if(Form.email1 && Form.usr_pass1)
			{
				if(Form.email1.value == "" ) {
				alert("Kindly enter your E-mail ID/User name.");
				Form.email1.focus();
				return false;
				}	
				if(Form.usr_pass1.value == "" ) {
				alert("Kindly enter your Password.");
				Form.usr_pass1.focus();
				return false;
				}
				if(Form.usr_pass1.value.length < 4) {
				alert("The Password should be atleast 4 characters long.");
				Form.usr_pass1.focus();
				return false;
				}
			}
		}

		if((Form.ph_area) && (Form.ph_area.value == 'Area Code'))
		{
			Form.ph_area.value = '';
		}
		if ((Form.ph_no) && (Form.ph_no.value =='Phone Number'))
		{
			Form.ph_no.value = '';
		}
		if((Form.mobile) && (Form.mobile.value == 'Mobile Number'))
		{
			Form.mobile.value = '';
		}
	}
	
	newCookie = Form.name;
	newCookie +="|"+Form.title.value;
	newCookie +="|"+Form.desc.value;
	newCookie +="|"+Form.period[period_index].value;
	newCookie +="|"+Form.qty.value;
	newCookie +="|"+Form.pay.value;
	newCookie +="|"+Form.supply.value;
	newCookie +="|"+Form.keywords.value;
	if(Form.first_name)
	{
		newCookie +="|"+Form.first_name.value;
	}
	else
	{
		newCookie +="|"+'';
	}
	if(Form.last_name)
	{
		newCookie +="|"+Form.last_name.value;
	}
	else
	{
		newCookie +="|"+'';
	}
	if(Form.email)
	{
		newCookie +="|"+Form.email.value;
	}
	else
	{
		newCookie +="|"+'';
	}
	if(Form.comp_name)
	{
		newCookie +="|"+Form.comp_name.value;
	}
	else
	{
		newCookie +="|"+'';
	}
	if(Form.ph_area)
	{
		newCookie +="|"+Form.ph_area.value;
	}
	else
	{
		newCookie +="|"+'';
	}
	if(Form.ph_no)
	{
		newCookie +="|"+Form.ph_no.value;
	}
	else
	{
		newCookie +="|"+'';
	}
	if(Form.website)
	{
		newCookie +="|"+Form.website.value;
	}
	else
	{
		newCookie +="|"+'';
	}
	if(Form.email1)
	{
		newCookie +="|"+Form.email1.value;
	}
	else
	{
		newCookie +="|"+'';
	}
	if(Form.mobile)
	{
		newCookie +="|"+Form.mobile.value;
	}
	else
	{
		newCookie +="|"+'';
	}
	setCookie("v4iilPostOfrData",newCookie);
	
	return true;
	
}

function getOfrData()
{
	if((cookie = getCookie("v4iilPostOfrData")) > "")
	{
		Values = cookie.split("|");
		if (Values.length >= 6)
		{
			var frmName = '';
			if (Values[0]) frmName = Values[0];
			frmObject = eval('document.'+frmName);
			if (Values[1]) frmObject.title.value  = Values[1];
			if (Values[2]) 
			{
				frmObject.desc.value = Values[2];
				frmObject.desc.className="po-input2a";
			}
			
			if (Values[3])
			{ 
				for (counter = 0; counter < frmObject.period.length; counter++)
				{
					if(frmObject.period[counter].value == Values[3])
					{
						frmObject.period[counter].checked = true;
					}
				}
			}
			if (Values[4]) frmObject.qty.value=Values[4];
			if (Values[5]) frmObject.pay.value=Values[5];
			if (Values[6]) frmObject.supply.value=Values[6];
			if (Values[7]) frmObject.keywords.value=Values[7];
			if (Values[8]) frmObject.first_name.value=Values[8];
			if (Values[9]) frmObject.last_name.value=Values[9];
			if (Values[10]) frmObject.email.value=Values[10];
			if (Values[11]) frmObject.comp_name.value=Values[11];
			if (Values[12]) frmObject.ph_area.value=Values[12];
			if (Values[13]) frmObject.ph_no.value=Values[13];
			if (Values[14]) frmObject.website.value=Values[14];
			if (Values[15]) frmObject.email1.value=Values[15];
			if (Values[16]) frmObject.mobile.value=Values[16];
			
			if(Values[4] || Values[5] || Values[6] || Values[7])
			{
				if(frmName == "postForm")
				{
					animatedcollapse.toggle('kelly');
				}
				else if(frmName == "postForm1")
				{
					animatedcollapse.toggle('kelly1');
				}
			}
		}
	}
}

function del(id,flag)
{	
	var par = window.parent.document;
	var txt=id;
	
	
	if(flag==0)
	{
		var txt1=txt.replace(/del/g, "d");
		var txt_hid = txt.replace(/del(.*?)/g,"$1");
		txt_hid='hid_name'+txt_hid;
		
		par.getElementById(txt1).style.display='none';
		par.getElementById(txt1).className = 'hidden1';
		
		var image=par.getElementById(txt_hid).value;
		var total_image=document.getElementById('image-name1').value;
		var my_array1=total_image.split(",");
		var len1=my_array1.length;
		document.getElementById('image-name1').value='';
		for(var i=0;i<len1;i++)
		{
			if(my_array1[i]==image)
			{
			}
			else
			{
				img=my_array1[i];
				if(document.getElementById('image-name1').value == '')
				{
					document.getElementById('image-name1').value=img;
				}
				else
				{
					var old_value=document.getElementById('image-name1').value;
					document.getElementById('image-name1').value=old_value+','+img;
				}
			}
		}
		//alert(document.getElementById('image-name1').value);
		par.getElementById(txt_hid).value = 'X';


		var count = document.getElementById('image_counter').value;
		if(count == 3)
		{
			count--;
			document.getElementById('image_counter').value=count;
			if(count < 3)
			{	
				var new_iframe = document.createElement('iframe');
				new_iframe.src = '/imghost/upload_eto.html';
				new_iframe.frameBorder = '0';
				new_iframe.height='36';
				new_iframe.width='300';
				new_iframe.scrolling='no';
				par.getElementById('iframe').appendChild(new_iframe);
				
			}
		}
		else
		{
			count--;
			document.getElementById('image_counter').value=count;
			
		}
	}
	
	if(flag==1)
	{
		var txt2=txt.replace(/del_new/g, "d_new");
		var txt_hid_new = txt2.replace(/d_new(.*?)/g,"$1");
		txt_hid_new='hid_name_new'+txt_hid_new;
		
		par.getElementById(txt2).style.display='none';
		par.getElementById(txt2).className = 'hidden1';
		
		var image=par.getElementById(txt_hid_new).value;
		var total_image=document.getElementById('image-name1').value;
		var my_array1=total_image.split(",");
		var len1=my_array1.length;
		document.getElementById('image-name1').value='';
		for(var i=0;i<len1;i++)
		{
			if(my_array1[i]==image)
			{
			}
			else
			{
				img=my_array1[i];
				if(document.getElementById('image-name1').value == '')
				{
					document.getElementById('image-name1').value=img;
				}
				else
				{
					var old_value=document.getElementById('image-name1').value;
					document.getElementById('image-name1').value=old_value+','+img;
				}
			}
		}
		//alert(document.getElementById('image-name1').value);
		
		
		par.getElementById(txt_hid_new).value = 'X';
		
		
		var count = document.getElementById('image_counter').value;
		
		if(count == 3)
		{
			count--;
			document.getElementById('image_counter').value=count;
			
			if(count < 3)
			{	
				var new_iframe = document.createElement('iframe');
				new_iframe.src = '/imghost/upload_eto.html';
				new_iframe.frameBorder = '0';
				new_iframe.height='36';
				new_iframe.width='300';
				new_iframe.scrolling='no';
				par.getElementById('iframe').appendChild(new_iframe);
			}
		}
		else
		{
			count--;
			document.getElementById('image_counter').value=count;
			
		}
	}
	
	// enabling submit buttons at image upload 
	if(par.getElementById('newreg'))
	{
		par.getElementById('newreg').disabled = false;
	}
	if(par.getElementById('login'))
	{
		par.getElementById('login').disabled = false;
	}
}		 

function del_frm1(id,flag)
{	
	var par = window.parent.document;
	var txt=id;
	
	
	if(flag==0)
	{
		var txt1=txt.replace(/del_frm1/g, "d_frm1");
		var txt_hid = txt.replace(/del_frm1(.*?)/g,"$1");
		txt_hid='hid_name_frm1'+txt_hid;
		
		par.getElementById(txt1).style.display='none';
		par.getElementById(txt1).className = 'hidden1';
		
		var image=par.getElementById(txt_hid).value;
		var total_image=document.getElementById('image-name1_frm1').value;
		var my_array1=total_image.split(",");
		var len1=my_array1.length;
		document.getElementById('image-name1_frm1').value='';
		for(var i=0;i<len1;i++)
		{
			if(my_array1[i]==image)
			{
			}
			else
			{
				img=my_array1[i];
				if(document.getElementById('image-name1_frm1').value == '')
				{
					document.getElementById('image-name1_frm1').value=img;
				}
				else
				{
					var old_value=document.getElementById('image-name1_frm1').value;
					document.getElementById('image-name1_frm1').value=old_value+','+img;
				}
			}
		}
		//alert(document.getElementById('image-name1').value);
		par.getElementById(txt_hid).value = 'X';


		var count = document.getElementById('image_counter_frm1').value;
		if(count == 3)
		{
			count--;
			document.getElementById('image_counter_frm1').value=count;
			if(count < 3)
			{	
				var new_iframe = document.createElement('iframe');
				new_iframe.src = '/imghost/upload_eto1.html';
				new_iframe.frameBorder = '0';
				new_iframe.height='36';
				new_iframe.width='300';
				new_iframe.scrolling='no';
				par.getElementById('iframe1').appendChild(new_iframe);
				
			}
		}
		else
		{
			count--;
			document.getElementById('image_counter_frm1').value=count;
			
		}
	}
	
	if(flag==1)
	{
		var txt2=txt.replace(/del_new_frm1/g, "d_new_frm1");
		var txt_hid_new = txt2.replace(/d_new_frm1(.*?)/g,"$1");
		txt_hid_new='hid_name_new_frm1'+txt_hid_new;
		
		par.getElementById(txt2).style.display='none';
		par.getElementById(txt2).className = 'hidden1';
		
		var image=par.getElementById(txt_hid_new).value;
		var total_image=document.getElementById('image-name1_frm1').value;
		var my_array1=total_image.split(",");
		var len1=my_array1.length;
		document.getElementById('image-name1_frm1').value='';
		for(var i=0;i<len1;i++)
		{
			if(my_array1[i]==image)
			{
			}
			else
			{
				img=my_array1[i];
				if(document.getElementById('image-name1_frm1').value == '')
				{
					document.getElementById('image-name1_frm1').value=img;
				}
				else
				{
					var old_value=document.getElementById('image-name1_frm1').value;
					document.getElementById('image-name1_frm1').value=old_value+','+img;
				}
			}
		}
		//alert(document.getElementById('image-name1').value);
		
		
		par.getElementById(txt_hid_new).value = 'X';
		
		
		var count = document.getElementById('image_counter_frm1').value;
		
		if(count == 3)
		{
			count--;
			document.getElementById('image_counter_frm1').value=count;
			
			if(count < 3)
			{	
				var new_iframe = document.createElement('iframe');
				new_iframe.src = '/imghost/upload_eto1.html';
				new_iframe.frameBorder = '0';
				new_iframe.height='36';
				new_iframe.width='300';
				new_iframe.scrolling='no';
				par.getElementById('iframe1').appendChild(new_iframe);
			}
		}
		else
		{
			count--;
			document.getElementById('image_counter_frm1').value=count;
			
		}
	}
	
	// enabling submit buttons at image upload 
	if(par.getElementById('newreg_frm1'))
	{
		par.getElementById('newreg_frm1').disabled = false;
	}
	if(par.getElementById('login_frm1'))
	{
		par.getElementById('login_frm1').disabled = false;
	}
}

function ListOnChange(txt,CatId,Catcount,cat_div_count)
{
txt=document.getElementById('txt_cat_mcat').value;
document.getElementById("s_result").style.display="block";
document.getElementById("head").innerHTML='';

	if(txt == 'type the keyword here ....' || txt.length < 3)
	{
		document.getElementById("s_result").style.display="none";
		alert("Enter at least three characters for search.");
		document.ssss.txt_cat_mcat.focus();
		return false;
	}
			
	if(txt.length > 2)
	{
		var xmlHttp=ajaxFunction();
		if(xmlHttp)
		{
			xmlHttp.onreadystatechange=function()
			{
				if(xmlHttp.readyState==4)
				{					
					if(xmlHttp.responseText)
					{
					document.getElementById("head").innerHTML='<B>Top categories found for "'+txt+'" </B>';
					document.getElementById("ajax").innerHTML=xmlHttp.responseText;
					document.getElementById("s_result1").style.display="block";
					}
					else
					{
					document.getElementById("s_result1").style.display="none";
					document.getElementById("head").innerHTML='No related categories found for "'+txt+'" <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -Kindly search with another product name to find related categories<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="#FF0000" size="1"> OR </font><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- Click here to <a href="javascript:beowswcat();">Browse Categories</a>';
					document.getElementById("ajax").innerHTML='';
					}
					
				}
				else
				{					
					document.getElementById("ajax").innerHTML='Searching..........<img src=/new/gifs/indicator.gif><BR>';
					document.getElementById("s_result1").style.display="none";
				}
			}
			
			var str="/cgi/prd-search-new.pl?ss="+escape(txt)+"&opt=2&smode=1&module=TEST&tpl=5";
			
				xmlHttp.open("GET",str,true);
			
			xmlHttp.send(null);
		}
	}
	return false;
}

function getblank(this1)
{
	if (this1.value == "type the keyword here ....")
	{
		this1.value = "";
	}
	return true;
}

var new_gid='';
var new_cid='';
var new_mid='';
var selectedValue = '';

function display(f,id)
{
	a=selectedValue;
	arr = a.split(" >> ");
	if(arr[2])
	{
		x = arr[0] + " >> " + arr[1] + " >> " + f;
	}
	else
	{
		x = arr[0] + " >> " + arr[1] + " >> " + f;
	}	
	selectedValue=x;
	new_mid=id;
	
	//parent.document.postForm.mcat.value=id;
	//parent.document.getElementById('s').innerHTML=x;
}


function grpajaxFunction()
{
	new_gid='';
	new_cid='';
	new_mid='';
	document.getElementById('submit').style.display="none";
	//document.getElementById('sel_mcat').value='';

	var xmlHttp;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{		
		//document.myForm.fullname.value=xmlHttp.responseText;
		
		var display_grp='<SELECT STYLE="width:100%" SIZE="10" name="grp" ID="grp" onclick="catajaxFunction();">'+xmlHttp.responseText+'</SELECT>';
		document.getElementById('grp1').innerHTML=display_grp;
		}
	}
	xmlHttp.open("GET","/cgi/grp.pl",true);
	xmlHttp.send(null);
}

function catajaxFunction(id)
{
	document.getElementById('display_mcat').className='displayoff';
	document.getElementById('submit').style.display="block";
	document.getElementById("s1").value = ''
	id= document.test.grp.options[document.test.grp.selectedIndex].value;
	new_gid = document.test.grp.options[document.test.grp.selectedIndex].value;
	//parent.document.postForm.group.value=id;
	url = "/cgi/grp.pl?grpid="+id;
	document.getElementById('css').className='displayon';
	
	var xmlHttp;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
		//document.myForm.fullname.value=xmlHttp.responseText;
		var display_cat='<SELECT name="cat" id="cat" STYLE="width:100%" SIZE="10" onclick="mcatajaxFunction();">'+xmlHttp.responseText+'</SELECT>';
		document.getElementById('cat1').innerHTML=display_cat;
		}
		else
		{
		document.getElementById('cat1').innerHTML='<div align="center"><img src=/new/gifs/indicator.gif></div>';
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function mcatajaxFunction(id)
{

selectedValue = document.test.grp.options[document.test.grp.selectedIndex].text+' >> '+document.test.cat.options[document.test.cat.selectedIndex].text;

//document.getElementById('sel_mcat').value='';

	id= document.test.cat.options[document.test.cat.selectedIndex].value;
	new_cid= document.test.cat.options[document.test.cat.selectedIndex].value;
	//parent.document.postForm.category.value=id;
	url = "/cgi/grp.pl?catid="+id;
	
	var xmlHttp;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{		
		//document.myForm.fullname.value=xmlHttp.responseText;
		var display_mcat='<div style="border: 1px solid rgb(51, 102, 153); background-color:#ffffff; overflow: auto; height: 165px; padding-left:1px; font-size: 13px;" id="mcat"></div>';
		temp=xmlHttp.responseText;
		myarr = temp.split("###");
			if(myarr[1] > 0)
			{				
				document.getElementById('display_mcat').className='displayon';
				document.getElementById('mcat').innerHTML=myarr[0];
					
			}
			else
			{
				document.getElementById('display_mcat').className='displayoff';
				
			}
		}
		else
		{
		document.getElementById('mcat').innerHTML='<div align="center"><br><br><br><img src=/new/gifs/indicator.gif></div>';
		}
		
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function t_description(Form)
{
	if(Form.desc.value=='Please enter your buying requirements in detail. Provide key information like product specifications, estimated quantity etc.')
	{
		Form.desc.value='';
		Form.desc.className="po-input2a";
	}
}
    
function settext(Form)
{
	if(Form.desc.value=='')
	{
		Form.desc.value='Please enter your buying requirements in detail. Provide key information like product specifications, estimated quantity etc.';
		Form.desc.className="po-input2";
	}    
}

function t_description1(Form)
{
	if(Form.desc.value=='Please enter your selling requirements in detail. Provide key information like product specifications, estimated quantity etc.')
	{
		Form.desc.value='';
		Form.desc.className="po-input2a";
	}
}
    
function settext1(Form)
{
	if(Form.desc.value=='')
	{
		Form.desc.value='Please enter your selling requirements in detail. Provide key information like product specifications, estimated quantity etc.';
		Form.desc.className="po-input2";
	}    
}	

function tab1()
{
document.getElementById('div1').style.display="block";
document.getElementById('div2').style.display="none";

document.getElementById('td1').className="selectoffernew";
document.getElementById('Radio1_B').checked=true;

}

function tab2()
{
document.getElementById('div1').style.display="none";
document.getElementById('div2').style.display="block";

document.getElementById('td2').className="postoffernew";
document.getElementById('Radio2_S').checked=true;

}

function upload_success(image_index,image_120x90,image_320x240,image_640x480,image_100x100)
{
	par = document;
	
	var s='show'+image_index;
	var d='del'+image_index;
	var p='iamge_name'+image_index;
	
	var x_div=par.getElementById(s);
	x_div.innerHTML="<a href=\"javascript:void(0);\" onClick=\"window.open('"+image_640x480+"' ,'mywindow','width=660,height=495,left=5,top=5,bottom=5,rigth=5,titlebar=no,menubar=no,toolbar=no,location=no,scrollbars=no,status=no,resizable=yes')\"><img src="+image_120x90+" border=\"0\"></a>";
	
	par.getElementById(d).value="Delete";
	
	// enabling submit buttons at image upload 
	if(par.getElementById('newreg'))
	{
		par.getElementById('newreg').disabled = false;
	}
	if(par.getElementById('login'))
	{
		par.getElementById('login').disabled = false;
	}
}

function upload_failure(index)
{
	var par = window.parent.document;
	alert('Image is not uploaded.');
	
	var txt='del'+index;
	var txt1=txt.replace(/del/g,"d");
	var txt_hid = txt.replace(/del(.*?)/g,"$1");
	txt_hid='hid_name'+txt_hid;
	par.getElementById(txt1).style.display='none';
	par.getElementById(txt1).className = 'hidden1';
	var image=par.getElementById(txt_hid).value;
	document.getElementById('image-name1').value='';
	par.getElementById(txt_hid).value = 'X';
	
	var count = document.getElementById('image_counter').value;
	if(count == 3)
	{
		count--;
		document.getElementById('image_counter').value=count;
		par = window.parent.document.getElementById('iframe');
		var num = par.getElementsByTagName('iframe').length - 1;
		var iframe = par.getElementsByTagName('iframe')[num];
		iframe.className = 'hidden';
		var new_iframe = document.createElement('iframe');
		new_iframe.src = '/imghost/upload_eto.html';
		new_iframe.frameBorder = '0';
		new_iframe.height='36';
		new_iframe.width='300';
		new_iframe.scrolling='no';
		par=window.parent.document;
		par.getElementById('iframe').appendChild(new_iframe);
	}
	
	// enabling submit buttons at image upload 
	if(par.getElementById('newreg'))
	{
		par.getElementById('newreg').disabled = false;
	}
	if(par.getElementById('login'))
	{
		par.getElementById('login').disabled = false;
	}
}

function upload_success_frm1(image_index,image_120x90,image_320x240,image_640x480,image_100x100)
{
	par = document;
	
	var s='show_frm1'+image_index;
	var d='del_frm1'+image_index;
	var p='iamge_name_frm1'+image_index;
	
	var x_div=par.getElementById(s);
	x_div.innerHTML="<a href=\"javascript:void(0);\" onClick=\"window.open('"+image_640x480+"' ,'mywindow','width=660,height=495,left=5,top=5,bottom=5,rigth=5,titlebar=no,menubar=no,toolbar=no,location=no,scrollbars=no,status=no,resizable=yes')\"><img src="+image_120x90+" border=\"0\"></a>";
	
	par.getElementById(d).value="Delete";
	
	// enabling submit buttons at image upload 
	if(par.getElementById('newreg_frm1'))
	{
		par.getElementById('newreg_frm1').disabled = false;
	}
	if(par.getElementById('login_frm1'))
	{
		par.getElementById('login_frm1').disabled = false;
	}
}

function upload_failure_frm1(index)
{
	var par = window.parent.document;
	alert('Image is not uploaded.');
	
	var txt='del_frm1'+index;
	var txt1=txt.replace(/del_frm1/g,"d_frm1");
	var txt_hid = txt.replace(/del_frm1(.*?)/g,"$1");
	txt_hid='hid_name_frm1'+txt_hid;
	par.getElementById(txt1).style.display='none';
	par.getElementById(txt1).className = 'hidden1';
	var image=par.getElementById(txt_hid).value;
	document.getElementById('image-name1_frm1').value='';
	par.getElementById(txt_hid).value = 'X';
	
	var count = document.getElementById('image_counter_frm1').value;
	if(count == 3)
	{
		count--;
		document.getElementById('image_counter_frm1').value=count;
		par = window.parent.document.getElementById('iframe1');
		var num = par.getElementsByTagName('iframe').length - 1;
		var iframe = par.getElementsByTagName('iframe')[num];
		iframe.className = 'hidden';
		var new_iframe = document.createElement('iframe');
		new_iframe.src = '/imghost/upload_eto1.html';
		new_iframe.frameBorder = '0';
		new_iframe.height='36';
		new_iframe.width='300';
		new_iframe.scrolling='no';
		par=window.parent.document;
		par.getElementById('iframe1').appendChild(new_iframe);
	}
	
	// enabling submit buttons at image upload 
	if(par.getElementById('newreg_frm1'))
	{
		par.getElementById('newreg_frm1').disabled = false;
	}
	if(par.getElementById('login_frm1'))
	{
		par.getElementById('login_frm1').disabled = false;
	}
}

// new codes for new postofr form end

function checkType(id)
{
	if(document.getElementById(id).checked == false)
	{
		alert("Please Select Offer Type First");
		document.getElementById(id).focus();
		return false;
	}
}

function shareshow(obj)
{
document.getElementById(obj).style.display="block";
}

function sharehide(obj)
{
document.getElementById(obj).style.display="none";
}

function txtPhArea(Form)
{
	if(Form.ph_area.value == 'Area Code')
	{
		Form.ph_area.value = '';
	}
	Form.ph_area.className='n_atxt1';	
}

function settextPhArea(Form)
{
	if (Form.ph_area.value=='')  
	{
		Form.ph_area.value='Area Code';
		Form.ph_area.className='n_atxt';
	}
}	


function txt1PhNo(Form)
{
	if(Form.ph_no.value=='Phone Number')
	{
		Form.ph_no.value='';
		Form.ph_no.className='n_atxt1';
	}
}

function settext1PhNo(Form)
{
	if(Form.ph_no.value=='')
	{
		Form.ph_no.value='Phone Number';
		Form.ph_no.className='n_atxt';
	}
}	


function txt2Mobile(Form)
{
	if(Form.mobile.value=='Mobile Number')
	{
		Form.mobile.value='';
		Form.mobile.className='n_atxt1';
	}
}

function settext2Mobile(Form)
{
	if (Form.mobile.value=='')
	{
		Form.mobile.value='Mobile Number';
		Form.mobile.className='n_atxt';
	}
}

function hlpshow()
{
	if(document.getElementById('phonehlp'))
	{
		document.getElementById('phonehlp').style.display="block";
	}
	if(document.getElementById('phonehlp_frm1'))
	{
		document.getElementById('phonehlp_frm1').style.display="block";
	}
}

function hlphide()
{
	if(document.getElementById('phonehlp'))
	{
		document.getElementById('phonehlp').style.display="none";
	}
	if(document.getElementById('phonehlp_frm1'))
	{
		document.getElementById('phonehlp_frm1').style.display="none";
	}
}


/*Js for Subscription Page*/
function fn_subs()
{

if(document.ModReg.first_name.value=='First Name')	
	{
document.ModReg.first_name.value='';
document.ModReg.first_name.className="txtfld1";
}		
}
    
function fnset_subs()
{
	if (document.ModReg.first_name.value=='')  {
		document.ModReg.first_name.value='First Name';
		document.ModReg.first_name.className="txtfld";
}    
}	

function lnnew_subs()
{
if(document.ModReg.last_name.value=='Last Name')
{

document.ModReg.last_name.value='';
document.ModReg.last_name.className="txtfld1";
}		
}
    
function lnset_subs()
{
	if (document.ModReg.last_name.value=='')  {
		document.ModReg.last_name.value='Last Name';
		document.ModReg.last_name.className="txtfld";
}    
}	



function ac_subs()
{

if(document.ModReg.ph_area.value=='Area Code')	
	{
document.ModReg.ph_area.value='';
document.ModReg.ph_area.className="txtfld1";
}		
}
    
function acset_subs()
{
	if (document.ModReg.ph_area.value=='')  {
		document.ModReg.ph_area.value='Area Code';
		document.ModReg.ph_area.className="txtfld";
}    
}	

function ph_subs()
{
	if(document.ModReg.ph_no.value=='Phone Number')	
	{
		document.ModReg.ph_no.value='';
		document.ModReg.ph_no.className="txtfld1";
	}
}
    
function phset_subs()
{
	if (document.ModReg.ph_no.value=='')  
	{
		document.ModReg.ph_no.value='Phone Number';
		document.ModReg.ph_no.className="txtfld";
	}
}	

function mo_subs()
{
	if(document.ModReg.mobile.value=='Mobile Number')	
	{
		document.ModReg.mobile.value='';
		document.ModReg.mobile.className="txtfld1";
	}
}
    
function moset_subs()
{
	if (document.ModReg.mobile.value=='')  
	{
		document.ModReg.mobile.value='Mobile Number';
		document.ModReg.mobile.className="txtfld";
	}
}	
function ci_subs()
{
	if(document.ModReg.city.value=='City')	
	{
		document.ModReg.city.value='';
		document.ModReg.city.className="txtfld1";
	}
}
    
function ciset_subs()
{
	if (document.ModReg.city.value=='')  
	{
		document.ModReg.city.value='City';
		document.ModReg.city.className="txtfld";
	}
}

function st_subs()
{
	if(document.ModReg.state.value=='State')	
	{
		document.ModReg.state.value='';
		document.ModReg.state.className="txtfld1";
	}
}

function stset_subs()
{
	if (document.ModReg.state.value=='')  
	{
		document.ModReg.state.value='State';
		document.ModReg.state.className="txtfld";
	}
}
	
function pc_subs()
{
	if(document.ModReg.zip.value=='Postal Code')	
	{
		document.ModReg.zip.value='';
		document.ModReg.zip.className="txtfld1";
	}
}

function pcset_subs()
{
	if (document.ModReg.zip.value=='')  
	{
		document.ModReg.zip.value='Postal Code';
		document.ModReg.zip.className="txtfld";
	}
}	


function linenew_subs()	
{
	if(document.getElementById('kelly').style.display=="none")
	{
		document.getElementById('lineb').className="boxnew1";
		document.getElementById('linebottom2').className="paddtab1";
	}
	else
	{
		document.getElementById('lineb').className="boxnew";
		document.getElementById('linebottom2').className="paddtab";
	}
}

function cardbox()
{
document.getElementById('card').className="change1"
document.getElementById('net').className="change2"
}

function netbox()
{
document.getElementById('card').className="change"
document.getElementById('net').className="change3"
}


function Check_Login_Sub(Form)
{
	if(Form.first_name.value == "" || Form.first_name.value == 'First Name')
	{
		Form.first_name.value='';
		Form.first_name.className="txtfld1";
		alert("Kindly enter First Name.");
		Form.first_name.focus();
		return false;
	}

	if(Form.last_name.value == "" || Form.last_name.value == 'Last Name')
	{
		Form.last_name.value='';
		Form.last_name.className="txtfld1";
		alert("Kindly enter your Last Name.");
		Form.last_name.focus();
		return false;
	}

	if(Form.country_name.value == "") 
	{
		alert("Kindly enter your Country Name.");
		Form.country_name.focus();
		return false;
	}

	/*check all default values*/
	if((Form.ph_area) && (Form.ph_area.value == 'Area Code'))
	{
		Form.ph_area.value = '';
		Form.ph_area.className="txtfld1";
	}
	if ((Form.ph_no) && (Form.ph_no.value =='Phone Number'))
	{
		Form.ph_no.value = '';
		Form.ph_no.className="txtfld1";
	}
	if((Form.mobile) && (Form.mobile.value == 'Mobile Number'))
	{
		Form.mobile.value = '';
		Form.mobile.className="txtfld1";
	}
	if((Form.txtCity) && (Form.txtCity.value == 'City'))
	{
		Form.txtCity.value = '';
	}
	if((Form.txtState) && (Form.txtState.value == 'State'))
	{
		Form.txtState.value = '';
	}
	if((Form.zip) && (Form.zip.value == 'Postal Code'))
	{
		Form.zip.value = '';
	}
	/*check all default values*/

	if((Form.ph_no) && (Form.mobile))
	{
		if (((Form.ph_no.value =='Phone Number') || (Form.ph_no.value.length == 0 )) && ((Form.mobile.value == 'Mobile Number') || (Form.mobile.value.length == 0)))
		{
			alert ("Kindly enter either Phone Number or Mobile Number.");
			Form.ph_no.focus();
			return false;
		}
			
		if(/^\s+$/.test(Form.ph_area.value))
		{
			alert ("Remove spaces from Phone (Area Code).");
			Form.ph_area.focus();
			return false;
		}
		
		if((/\s+/.test(Form.ph_no.value)) && (Form.ph_no.value != 'Phone Number'))
		{
			alert ("Remove spaces from Phone Number.");
			Form.ph_no.focus();
			return false;
		}
		
		if(!(/^\d+$/.test(Form.mobile.value)) && (Form.mobile.value != 'Mobile Number') && (Form.mobile.value != ''))
		{
			alert ("Kindly enter numeric value in Mobile Number.");
			Form.mobile.focus();
			return false;
		}
	}

	if(Form.mobile.value !='') {
		if(Form.mobile.value.length > 40) {
			alert("Your Mobile no. should not exceed 40 digits.");
			Form.mobile.focus();
			return false;
		}
// 		if(Form.mobile.value.length < 10) {
// 			alert("Your Mobile no. should be greater than 10 digits.");
// 			Form.mobile.focus();
// 			return false;
// 		}
	}

	if(Form.add1.value == "") 
	{
		alert("Kindly enter your Address.");
		Form.add1.focus();
		return false;
	}

	if(Form.txtState.value == "")
	{
		alert("Kindly enter your State.");
		Form.txtState.focus();
		return false;
	}

	if(Form.txtCity.value == "")
	{
		alert("Kindly enter your City.");
		Form.txtCity.focus();
		return false;
	}
	if(Form.zip.value == "")
	{
		alert("Kindly enter your Postal Code.");
		Form.zip.focus();
		return false;
	}

	if(Form.email.value == "" ) 
	{
		alert("Kindly enter your E-mail ID/User name.");
		Form.email.focus();
		return false;
	}

	if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(Form.email.value))) 
	{
		alert("Invalid Email ID. Kindly enter the correct ID.");
		Form.email.focus();
		return false;
	}

	if(Form.paygtway && Form.paygtway[0].checked == false && Form.paygtway[1].checked == false)
	{
		alert("Kindly enter payment gateway.");
		Form.paygtway[0].focus();
		return false;
	}
	
}

// function frmsubmit(id)
// {
// 	var j=0;
// 	for(i=0;i<document.showPlan.plan.length;i++)
// 	{
// 		if(id != 'undefined' && id == i)
// 		{
// 			document.showPlan.plan[i].checked = true;
// 		}
// 
// 		if(document.showPlan.plan[i].checked == true)
// 		{
// 			j=1;
// 		}
// 	}
// 
// 	if(j == 0)
// 	{
// 		alert("Please select subscription plan");
// 		document.showPlan.plan[0].focus();
// 		return false;
// 	}
// 	
// 	document.showPlan.submit();
// 	return true;
// }

function frmsubmit(id)
{
	var j=0;
	if(id)
	{
		for(i=0;i<document.showPlan.plan.length;i++) {
		if(document.showPlan.plan[i].value == id) { document.showPlan.plan[i].checked = true; j=1; break;} }
	}
	else
	{
		for(i=0;i<document.showPlan.plan.length;i++) {
		if(document.showPlan.plan[i].checked == true) {j=1; break;} }
	}
	
	if(j == 0) {
		alert("Please select subscription plan");
		document.showPlan.plan[0].focus();
		return false; }
	document.showPlan.submit();
	return true;
}
/*Js for Subscription Page*/