//Post Form Javascripts

// $Id: eto-1.1.js 18956 2010-01-30 04:10:22Z gunjan $
// $HeadURL: http://qmail1/svn/im-sw/indiamart-trade/trunk/main/eto-1.1.js $


function mail()
{
	document.location="mailto:info\@indiamart.com?subject="+document.location;
}

function goback() {history.go(-1)};

function checkSearch()
{
	if (document.searchForm.search.value=="")
	{
		alert("Please enter your search string");
		document.searchForm.search.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function checkSearch2()
{
	if (document.searchForm2.search.value=="")
	{
		alert("Please enter your search string");
		document.searchForm2.search.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function openpopup(thisurl)
{
	msgWindow=window.open( thisurl,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=no,menubar=no,resizable=yes,width=515, height=440,screenX=190,screenY=0');
}

function openchildts(thisurl)
{
	browserName = navigator.appName;
	browserVer = parseInt(navigator.appVersion);
	condition = !(( (browserName.indexOf("Explorer") >=0 ) && (browserVer < 4) ) ||  ((browserName.indexOf("Netscape") >=0 ) && (browserVer < 2) ) ) ;
	if (condition == true  )
	CanAnimate = true;
	else
	CanAnimate = false;

	if ( CanAnimate )
	{
		var windowHeight;
		var windowWidth;
		var windowTop;
		var windowLeft;
		windowHeight=(screen.height*(80/100))*0.85;
		windowWidth=(screen.width*(57/100)-200);
		windowTop=(screen.height*(20/100))*0.8;
		windowLeft=screen.width*(40.2/100);
	
		msgWindow=window.open( '' ,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,top='+windowTop+',left='+windowLeft+',width='+windowWidth+',height='+windowHeight);
		msgWindow.focus();
		msgWindow.location.href = thisurl;
	}
	else 
	{
        	msgWindow=window.open( thisurl,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=510,height=420');
	}

}

function CheckDataSearch(Form){
	Form.ss.value = Form.ss.value.replace(/[^a-zA-Z0-9 ]/g, ' ');
	Form.ss.value = Form.ss.value.replace(/^\s+/g, '').replace(/\s+$/g, '');
	while(Form.ss.value.indexOf('  ')>0){
		Form.ss.value = Form.ss.value.replace('  ',' ');
	}
	
	var temp=Form.ss.value.replace(/\s/g, '');
	if (temp.length < 3){
		alert("Enter at least three characters for search.");
		Form.ss.focus();
		return false;
	}
	else
	{
		var str = Form.ss.value.replace(/\s/g, '+');
		if(Form.searchfor.value == "comp"){
			str ='ss='+escape(str);
			str = "http://dir.indiamart.com/cgi/compcatsearch.mp?"+str;
			str = myReplace(str,"\\\\?\\\\&","?");
			window.location = str;
			return false;
                }
                else if(Form.searchfor.value == "product"){
			str ='ss='+escape(str);
			str = "http://catalogs.indiamart.com/cgi/catprdsearch.mp?"+str;
			str = myReplace(str,"\\\\?\\\\&","?");
			window.location = str;
			return false;
                }
                else if(Form.searchfor.value == "offer"){
 			str ='search='+escape(str);
			str = "/search.mp?"+str;
			str = myReplace(str,"\\\\?\\\\&","?");
			window.location = str;
			return false;
                }
		else if(Form.searchfor.value == "tenders"){
			str ='ss='+escape(str);
			str = "http://tenders.indiamart.com/search.cgi?"+str;
			str = myReplace(str,"\\\\?\\\\&","?");
			window.location = str;
			return false;
		}
	}
}

function myReplace(str, a, b) {
        var re = new RegExp(a, "g");
        var ret = str.replace(re,b);
        return ret;
}

// ptl code by janesh

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;
			
		}
	}
}

//ptl code

// New mouse over Photo Display code by JOY

function clickHandler(e) { 
  var top = 0, left = 0; 
  var a = new Array();
  if (!e) { e = window.event; } 
  var myTarget = e.currentTarget; 
  if (!myTarget) { 
   myTarget = e.srcElement; 
  } 
  else if (myTarget == "undefined") { 
   myTarget = e.srcElement; 
  } 
  while(myTarget!= document.body) { 
     top += myTarget.offsetTop; 
     left += myTarget.offsetLeft; 
     myTarget = myTarget.offsetParent; 
  } 
  a[0] = left;
  a[1] = top;
  return(a);
} 

function load_div(div_id,event,path_150,imgsrc,photo_protected,browser) {
	if(photo_protected != "Y"){
		var bName = navigator.appName;
		var bVer = parseFloat(navigator.appVersion);
		if (bName == "Netscape")
		var browser = "Netscape Navigator";
		else
		var browser = bName;
		left = clickHandler(event);
		var pad_left = left[0]+74;
		var pad_top = left[1]+12;
		document.getElementById(div_id).style.left = pad_left+"px";
		document.getElementById(div_id).style.top = pad_top+"px";
		//document.getElementById(div_id).style.width="150px";
		//document.getElementById(div_id).style.height="150px";
		if(browser == "Microsoft Internet Explorer") {
			document.getElementById(div_id).style.border="solid 1px #71A3C5";
		}
		document.getElementById(div_id).style.display = "block";	
		document.getElementById(div_id).innerHTML = "<font style='font-family:arial;'>Loading....</font>";
		show_photo150(div_id,event,path_150,imgsrc,photo_protected);
	}
}

function show_photo150(div_id,event,path_150,imgsrc,photo_protected,browser) {
	if(photo_protected != "Y"){
		//left = clickHandler(event);
		//var pad_left = left[0]+74;
		//var pad_top = left[1]+12;
		document.getElementById(div_id).innerHTML="<img src='"+document.getElementById(imgsrc).value+" ' border='0' vspace='2' hspace='2' style='border:1px solid #ffffff;padding:3px;' id="+path_150+">";

		//document.getElementById(div_id).style.left = pad_left+"px";
		//document.getElementById(div_id).style.top = pad_top+"px";
		//document.getElementById(path_150).style.padding="3px";
		//if(browser == "Microsoft Internet Explorer") {
		//	document.getElementById(div_id).style.border="solid 1px #ffffff";
		//}
		//document.getElementById(path_150).src=document.getElementById(imgsrc).value;
		document.getElementById(path_150).style.background="#FFFFFF";
		//document.getElementById(div_id).style.display = "block";
	}
}

function hide_photo150(div_id) {
	document.getElementById(div_id).style.display = "none";
}

// New mouse over Photo Display code Ends

function popup(url)
{
	window.open(url, 'Lookup', 'toolbar=no, location=no, directories=no, status=no, scrollbars=yes, resizable=yes, copyhistory=no, width=600, height=260');
}

function checkFields()
{
	if (!checkTextField(document.responseForm.mesg,'mesg'))
	{
		return false;
	} else
	{
		return true;
	}
}

function checkTextField(field,field_name)
{
	if (field.value=="")
	{
		alert("Please fill value for "+field_name);
		field.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function showhide(){
    if(document.getElementById("newuser").style.display == "none")
    {
        document.getElementById("newuser").style.display = "block"; 
    } else {
        document.getElementById("newuser").style.display = "none";
    }

    if(document.getElementById("aro").style.display == "none")
    {
        document.getElementById("aro").style.display = "block"; 
    } else {
        document.getElementById("aro").style.display = "none";
    }	

    if(document.getElementById("aro1").style.display == "none")
    {
        document.getElementById("aro1").style.display = "block"; 
    } else {
        document.getElementById("aro1").style.display = "none";
    }	
}

/* Glusr Registration Form Checking */

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 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 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 assign_hidden_param()
{
	if(document.ModReg.txtState_SelectedValue.value != '')
	{
		document.ModReg.state_others.value=document.ModReg.txtState.value;
		document.ModReg.state.value=document.ModReg.txtState_SelectedValue.value;
		
//		document.ModReg.state_list_info.value=document.ModReg.txtState.value;
//		document.ModReg.state_text_info.value='';
	}
	else
	{
		document.ModReg.state_others.value=document.ModReg.txtState.value;
		document.ModReg.state.value='';
		
//		document.ModReg.state_list_info.value='';
//		document.ModReg.state_text_info.value=document.ModReg.txtState.value;
	}
	
	if(document.ModReg.txtCity_SelectedValue.value != '')
	{
		document.ModReg.city_others.value=document.ModReg.txtCity.value;
		document.ModReg.city.value=document.ModReg.txtCity_SelectedValue.value;
		
//		document.ModReg.city_list_info.value=document.ModReg.txtCity.value;
//		document.ModReg.city_text_info.value='';
	}
	else
	{
		document.ModReg.city_others.value=document.ModReg.txtCity.value;
		document.ModReg.city.value='';
		
//		document.ModReg.city_list_info.value='';
//		document.ModReg.city_text_info.value=document.ModReg.txtCity.value;
	}
}

function Check_ModReg(makeCookie)
{
/*	var data = new Array();
	data =[!%ARR_COUNTRY_NAME%!];
*/	
	assign_hidden_param(); // setting the hidden parameters of states & cites ...
	
	if(document.ModReg.first_name.value == "" ) {
		alert("Kindly enter your First Name.");
		document.ModReg.first_name.focus();
		return false;
	}
	
	

	if(trim(document.ModReg.str_add1.value) == "") {
		alert("Kindly enter your Address.");
		document.ModReg.str_add1.focus();
		return false;
	}
	
	if(document.ModReg.country_name.value == "") {
		alert("Kindly select the Country.");
		document.ModReg.country_name.focus();
		return false;
	}

// 	if(document.ModReg.country_iso.value == 0) {
// 		alert("Kindly select the Country.");
// 		document.ModReg.country.focus();
// 		return false;
// 	}
	
	if(trim(document.ModReg.city_others.value) == "") {
		alert("Kindly enter your City.");
		document.ModReg.txtCity.focus()
		return false;
	}
	
	if(trim(document.ModReg.zip.value) == "" ) {
		alert("Kindly enter the Zip/Pin Code.");
		document.ModReg.zip.focus();
		return false;
	}

	if(document.ModReg.email.value == "" ) {
		alert("Kindly enter your E-mail ID.");
		document.ModReg.email.focus();
		return false;
	}
	else if (document.ModReg.email.value.length != 0)
	{
		if(document.ModReg.email.value.indexOf(" ") != -1)	{
		alert("Kindly enter correct E-Mail ID without any spaces in it.");
		document.ModReg.email.focus();
		return false;
		}
	
		if(document.ModReg.email.value.indexOf("@") == -1)	{
		alert("Invalid E-Mail ID! Kindly enter correct E-Mail ID.");
		document.ModReg.email.focus();
		return false;
		}
		if(document.ModReg.email.value.indexOf(",") != -1)	{
		alert("Invalid E-Mail ID! Kindly enter correct E-Mail ID.");
		document.ModReg.email.focus();
		return false;
		}
		if(document.ModReg.email.value.indexOf(")") != -1)	{
		alert("Invalid E-Mail ID! Kindly enter correct E-Mail ID.");
		document.ModReg.email.focus();
		return false;
		}
		if(document.ModReg.email.value.indexOf("(") != -1)	{
		alert("Invalid E-Mail ID! Kindly enter correct E-Mail ID.");
		document.ModReg.email.focus();
		return false;
		}
		validarr = document.ModReg.email.value.split("@");
	
		if(validarr[0].length==0)   	{
		alert("Invalid E-Mail ID! Kindly enter the correct E-mail ID.");
		document.ModReg.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.");
			document.ModReg.email.focus();
			return false;
			}
			if(validemail[1].length<1)  		{
			alert("Invalid E-Mail ID! Kindly enter the correct E-mail ID.");
			document.ModReg.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.");
		document.ModReg.email.focus();
		return false;
		}
		if(validarr[1].length==0)   	{
		alert("Invalid E-Mail ID! Kindly enter the correct E-mail ID.");
		document.ModReg.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.");
			document.ModReg.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.");
			document.ModReg.email.focus();
			return false;
			}
			if(validemail[validemail.length-1].length<2)  		{
			alert("Invalid E-Mail ID! Kindly enter the correct E-mail ID.");
			document.ModReg.email.focus();
			return false;
			}
		}   // end of of validemail
	
	} // end of valid email-id check
	
	if(document.ModReg.ph_country.value == "") {
		alert("Kindly enter country code for Telephone Number.");
		document.ModReg.ph_country.focus();
		return false;
	}

// 	if(document.ModReg.ph_no.value == "" || document.ModReg.ph_no.value =='Phone Number') {
// 		document.ModReg.ph_no.value='';
// 		alert("Kindly enter your Telephone Number.");
// 		document.ModReg.ph_no.focus();
// 		return false;
// 	}

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

	if(document.ModReg.mobile.value=='Mobile Number')
	{
		document.ModReg.mobile.value='';
	}
 	if(document.ModReg.ph_area.value=='Area Code')
	{
		document.ModReg.ph_area.value='';
	}
	if(document.ModReg.ph_no.value=='Phone Number')
	{
		document.ModReg.ph_no.value='';
	}

	if ((document.ModReg.website) && document.ModReg.website.value.length != 0)
	{
		if(document.ModReg.website.value.indexOf(" ") != -1)	{
		alert("Kindly enter correct URL without any spaces in it.");
		document.ModReg.website.focus();
		return false;
		}
		if(document.ModReg.website.value.indexOf("@") != -1)	{
		alert("Invalid Website ! Kindly enter correct website.");
		document.ModReg.website.focus();
		return false;
		}
		if(document.ModReg.website.value.indexOf(".") == -1)	{
		alert("Invalid Website ! Kindly enter correct website.");
		document.ModReg.website.focus();
		return false;
		}
		validarr = document.ModReg.website.value.split(".");
	
		if(validarr[0].length<2)   	{
		alert("Invalid Website ! Kindly enter correct website.");
		document.ModReg.website.focus();
		return false;
		}
		if(validarr[1].length<2)   	{
		alert("Invalid Website ! Kindly enter correct website.");
		document.ModReg.website.focus();
		return false;
		}
	}

	if ((document.ModReg.captcha_text) && document.ModReg.captcha_text.value.length == 0)  {
			alert ("Kindly enter the code as appearing in the Image.");
			document.ModReg.captcha_text.focus();
			return false;
	}

	if ((document.ModReg.terms) && !document.ModReg.terms.checked) {
		alert("You must agree to the Terms of Use for your registration.");
		document.ModReg.terms.focus();
		return false;
	}

	if (document.ModReg.first_name.value.length  > 20)
	{
		alert("First Name should not exceed 20 characters.");
		document.ModReg.first_name.focus();
		return false;
	}
	if (document.ModReg.last_name.value.length  > 20)
	{
		alert("Last Name should not exceed 20 characters.");
		document.ModReg.last_name.focus();
		return false;
	}
	if (document.ModReg.email.value.length > 100)
	{
		alert("Email should not exceed 100 characters.");
		document.ModReg.email.focus();
		return false;
	}
	
	if ((document.ModReg.email2) && document.ModReg.email2.value.length > 100)
	{
		alert("Alternate Email should not exceed 100 characters.");
		document.ModReg.email2.focus();
		return false;
	}

	if(document.ModReg.country_name.value.length > 40) {
		alert("Country Name should not exceed 40 characters.");
		document.ModReg.country.focus();
		return false;
	}
	if(document.ModReg.ph_country.value.length > 6) {
		alert("Telephone (Country Code) should not exceed 6 characters.");
		document.ModReg.ph_country.focus();
		return false;
	}
	if(document.ModReg.ph_area.value !='') {
		if(isNaN(document.ModReg.ph_area.value))
		{
			alert("Telephone (Area Code) should be an integer value.");
			document.ModReg.ph_area.focus();
			return false;
		}
	}
	if(document.ModReg.ph_area.value.length > 6) {
		alert("Telephone (Area Code) should not exceed 6 characters.");
		document.ModReg.ph_area.focus();
		return false;
	}
	if(document.ModReg.ph_no.value.length > 35) {
		alert("Telephone (Number) should not exceed 35 characters.");
		document.ModReg.ph_no.focus();
		return false;
	}
	
	if(document.ModReg.ph_country2 && document.ModReg.ph_country2.value.length != '')
	{
		if(document.ModReg.ph_country2.value.length > 6) {
			alert("Alternate Telephone (Country Code) should not exceed 6 characters.");
			document.ModReg.ph_country2.focus();
			return false;
		}
		if(document.ModReg.ph_area2.value !='') {
			if(isNaN(document.ModReg.ph_area.value))
			{
				alert("Alternate Telephone (Area Code) should be an integer value.");
				document.ModReg.ph_area2.focus();
				return false;
			}
		}
		if(document.ModReg.ph_area2.value.length > 6) {
			alert("Alternate Telephone (Area Code) should not exceed 6 characters.");
			document.ModReg.ph_area2.focus();
			return false;
		}
		if(document.ModReg.ph_no2.value.length > 35) {
			alert("Alternate Telephone (Number) should not exceed 35 characters.");
			document.ModReg.ph_no2.focus();
			return false;
		}
	}
	
	if(document.ModReg.mobile.value !='') {
		if(document.ModReg.mobile.value.length > 40) {
			alert("Your Mobile no. should not exceed 40 digits.");
			document.ModReg.mobile.focus();
			return false;
		}
// 		if(document.ModReg.mobile.value.length < 10) {
// 			alert("Your Mobile no. should be greater than 10 digits.");
// 			document.ModReg.mobile.focus();
// 			return false;
// 		}
	}
	
	if(document.ModReg.mobile2 && document.ModReg.mobile2.value.length !='')
	{
		if(document.ModReg.mobile2.value.length > 40) {
		alert("Your Mobile no.2 should not exceed 40 digits.");
		document.ModReg.mobile2.focus();
		return false;
		}
		if(document.ModReg.mobile2.value.length < 10) {
		alert("Your Mobile no.2 should be greater than 10 digits.");
		document.ModReg.mobile2.focus();
		return false;
		}
	}
	
	if(document.ModReg.comp_name.value.length > 100) {
		alert("Company Name should not exceed 100 characters.");
		document.ModReg.comp_name.focus();
		return false;
	}
	if(document.ModReg.website.value.length > 100) {
		alert("Web Site Address (URL) should not exceed 100 characters.");
		document.ModReg.website.focus();
		return false;
	}

	if(makeCookie)
	{
		newCookie = document.ModReg.first_name.value;
		newCookie +="|"+document.ModReg.last_name.value;
		newCookie +="|"+document.ModReg.email.value;
		newCookie +="|"+document.ModReg.comp_name.value;
		newCookie +="|"+document.ModReg.str_add1.value;
		newCookie +="|"+document.ModReg.zip.value;
		newCookie +="|"+document.ModReg.ph_country.value;
		newCookie +="|"+document.ModReg.ph_area.value;
		newCookie +="|"+document.ModReg.ph_no.value;
		newCookie +="|"+document.ModReg.mobile.value;
		newCookie +="|"+document.ModReg.website.value;
		newCookie +="|"+document.ModReg.country_name.value;
		newCookie +="|"+document.ModReg.country_iso.value; /*hidden*/
		newCookie +="|"+document.ModReg.country.value; /*hidden*/
		
		setCookie("v4iilRegData",newCookie);
	}
}

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 updateprofile() {
	if (document.getElementById ('year_estb').value !=""){
		var cc=parseInt(document.getElementById ('year_estb').value);
		if(isNaN(document.getElementById ('year_estb').value))
		{
			alert("Kindly enter a numeric value for the Year of Establishment.");
			document.getElementById ('year_estb').focus();
			return false;
		}
		else if (document.getElementById ('year_estb').value.length != 4){
			alert("Kindly enter the Year of Establishment in YYYY format.");
			document.getElementById ('year_estb').focus();
			return false;
		}
		else if (cc > 2008){
			alert("Year of Establishment cannot be more than current year.");
			document.getElementById ('year_estb').focus();
			return false;
		}
		else if (cc < 1900){
			alert("Year of Establishment cannot be prior to 1900.");
			document.getElementById ('year_estb').focus();
			return false;
		}
	}
	if(document.ModReg.about_us.value.length > 4000) {
		alert("About Us should not exceed 4000 characters.");
		document.ModReg.about_us.focus();
		return false;
	}
	if(document.ModReg.quality.value.length > 4000) {
		alert("Quality Policy & Certification should not exceed 4000 characters.");
		document.ModReg.quality.focus();
		return false;
	}
	if(document.ModReg.usr_infrastructure.value.length > 4000) {
		alert("Factory & Infrastructure should not exceed 4000 characters.");
		document.ModReg.usr_infrastructure.focus();
		return false;
	}
	if(document.ModReg.usr_trademembership.value.length > 4000) {
		alert("Trade Memberships should not exceed 4000 characters.");
		document.ModReg.usr_trademembership.focus();
		return false;
	}
}

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  get()
{
	if((cookie = getCookie("v4iilRegData")) > "")
	{
		Values = cookie.split("|");

		if (Values.length >= 9)
		{
			if (Values[0]) document.ModReg.first_name.value  = Values[0];
			if (Values[1]) document.ModReg.last_name.value = Values[1];
			if (Values[2]) document.ModReg.email.value = Values[2];
			if (Values[3]) document.ModReg.comp_name.value=Values[3];
			if (Values[4]) document.ModReg.str_add1.value=Values[4];
			if (Values[5]) document.ModReg.zip.value=Values[5];
			if (Values[6]) document.ModReg.ph_country.value=Values[6];
			if (Values[7]) document.ModReg.ph_area.value=Values[7];
			if (Values[8]) document.ModReg.ph_no.value = Values[8];
			if (Values[9]) document.ModReg.mobile.value = Values[9];
			if (Values[10]) document.ModReg.website.value = Values[10];
			if (Values[11]) document.ModReg.country_name.value = Values[11];
			if (Values[12]) document.ModReg.country_iso.value = Values[12];
			if (Values[13]) document.ModReg.country.value = Values[13];
		}
	}
}

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 "";
}

//use for all images resizing...
function resize_hw(Obj, h, w)
{
	myImage = new Image();
// 	myImage.src = image;
	myImage.src = Obj.src;
	var height = myImage.height;
	var width  = myImage.width;


	if(height > h || width > w)
	{
		if(height > width)
		{
			var temp = height/h;

			var new_width = width / temp;
			new_width = parseInt(new_width);

			height = h;
			width = new_width;
		}
		else
		{
			var temp = width/w;

			var new_height = height / temp;
			new_height = parseInt(new_height);

			height = new_height;
			width = w;
		}
	}
	Obj.height = height;
	Obj.width = width;
}
//end of image resizing

// new codes for new postofr form starts

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)
{
	
	/* 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;
	}
	
	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<2)   		{
					alert("Invalid E-Mail ID! Kindly enter the correct E-mail ID.");
					Form.email.focus();
					return false;
					}
					if(validemail[1].length<2)  		{
					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<2)   		{
					alert("Invalid E-Mail ID! Kindly enter the correct E-mail ID.");
					Form.email.focus();
					return false;
					}
					if(validemail[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();
				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;
			}
			
			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;
				}
			}
		}
	}
	
	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 +="|"+'';
	}
	setCookie("v4iilPostOfrData",newCookie);
	alert("set");
	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[4] || Values[5] || Values[6] || Values[7])
			{
				if(frmName == "postForm")
				{
					animatedcollapse.toggle('kelly');
				}
				else if(frmName == "postForm1")
				{
					animatedcollapse.toggle('kelly1');
				}
			}
		}
	}
}

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);
}

// new code of new form 
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";

}

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

}

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";
	
}

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);
	}
}

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";
	
}

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);
	}
}

function Check_ModReg_Resp_New(Form)
{
	if(trim(Form.mesg.value) == "" || trim(Form.mesg.value) == "Please enter your response.")
	{
		alert("Please fill in your response.");
		Form.mesg.focus();
		return false;
	}
	if(Form.mesg.value.length > 2000) {
		alert("Your Response Message should not be more than 2000 characters.");
		Form.mesg.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<2)   		{
					alert("Invalid E-Mail ID! Kindly enter the correct E-mail ID.");
					Form.email.focus();
					return false;
					}
					if(validemail[1].length<2)  		{
					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<2)   		{
					alert("Invalid E-Mail ID! Kindly enter the correct E-mail ID.");
					Form.email.focus();
					return false;
					}
					if(validemail[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_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 numeric.");
					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 numeric.");
					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 (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(Form.email1.value))) 
				{
					alert("Invalid Email ID. Kindly enter the correct ID.");
					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.mesg.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.country_name)
	{
		newCookie +="|"+Form.country_name.value;
		newCookie +="|"+Form.country_iso.value; /*hidden*/
		newCookie +="|"+Form.country.value; /*hidden*/
		newCookie +="|"+Form.ph_country.value; /*read only*/
	}
	else
	{
		newCookie +="|"+'';
		newCookie +="|"+'';
		newCookie +="|"+'';
		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("v4iilRespOfrData",newCookie);
	return true;
	
}

function getRespOfrData()
{
	if((cookie = getCookie("v4iilRespOfrData")) > "")
	{
		Values = cookie.split("|");
		if (Values.length >= 6)
		{
			var frmName = '';
			if (Values[0]) frmName = Values[0];
			frmObject = eval('document.'+frmName);
			if (Values[1] && frmObject.mesg) frmObject.mesg.value  = Values[1];
			if (Values[2] && frmObject.first_name) frmObject.first_name.value=Values[2];
			if (Values[3] && frmObject.last_name) frmObject.last_name.value=Values[3];
			if (Values[4] && frmObject.email) frmObject.email.value=Values[4];
			if (Values[5] && frmObject.comp_name) frmObject.comp_name.value=Values[5];

			if (Values[6] && frmObject.country_name) frmObject.country_name.value=Values[6];
			if (Values[7] && frmObject.country_iso) frmObject.country_iso.value=Values[7];
			if (Values[8] && frmObject.country) frmObject.country.value=Values[8];
			if (Values[9] && frmObject.ph_country)
			{
				frmObject.ph_country.value=Values[9];
				frmObject.S_cmobile.value=Values[9];
			}
			if (Values[10] && frmObject.ph_area) frmObject.ph_area.value=Values[10];
			if (Values[11] && frmObject.ph_no) frmObject.ph_no.value=Values[11];
			if (Values[12] && frmObject.website) frmObject.website.value=Values[12];
			if (Values[13] && frmObject.email1) frmObject.email1.value=Values[13];
			if (Values[14] && frmObject.mobile) frmObject.mobile.value=Values[14];
		}
	}
}

function editSubject()
{
	document.getElementById('subjectold').style.display = "none";
	document.getElementById('subjectnew').style.display = "block";
}

function displaySubject()
{
	if(document.getElementById('subject'))
	{
		document.getElementById('offerSubject').value = document.getElementById('subject').value;
		document.getElementById('subjectold').innerHTML = '<B>Subject: </B>'+document.getElementById('subject').value+'&nbsp;&nbsp;<a href="javascript:void(0);" onclick="editSubject();">edit subject line</a>';
		document.getElementById('subjectnew').style.display = "none";
		document.getElementById('subjectold').style.display = "block";

		
	}

}


// Response ThankYOU Page JS to Update Sender Information -
 
function SwitchMenu(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("masterdiv").getElementsByTagName("div");
		if(el.style.display != "block"){
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="submenu")
				ar[i].style.display = "none";
			}
			el.style.display = "block";
		}
		else{
			el.style.display = "none";
		}
	}
}
function createRequestObject() {

       var req;

       if(window.XMLHttpRequest){
          // Firefox, Safari, Opera...
          req = new XMLHttpRequest();
       } else if(window.ActiveXObject) {
          // Internet Explorer 5+
          req = new ActiveXObject("Microsoft.XMLHTTP");
       } else {
          // There is an error creating the object,
          // just as an old browser is being used.
          alert('Problem creating the XMLHttpRequest object');
       }

       return req;

    }

    // Make the XMLHttpRequest object
    var http = createRequestObject();

    function checklogin() {
    	var S_email = document.getElementById ('S_email').value;
       var S_pass = document.getElementById ('S_pass').value;
       var action=document.getElementById ('action').value;
       var host = document.getElementById ('host').value;
       var S_name=document.getElementById ('S_name').value;
       	 if(document.getElementById ('S_email').value == '')
		 {
		 	alert("Kindly fill your email-id");
			document.getElementById ('S_email').focus();
			return (false);
		 }

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

		if(S_pass == "" ) {
		alert("Kindly enter your Password.");
		document.getElementById ('S_pass').focus();
		return false;
		}
		else if(S_pass.length < 4) {
		alert("The Password should be atleast 4 characters long.");
		document.getElementById ('S_pass').focus();
		return false;
		}
		else if(S_pass.indexOf(" ") != -1) {
alert("Kindly enter your Password without any spaces in it.");
document.getElementById ('S_pass').focus();
return false;
		}
		document.body.style.cursor = 'wait';

		http.open('GET', '/cgi/updateprofile.cgi?S_email='+S_email+'&action='+action+'&S_pass='+S_pass+'&host='+host+'&S_name='+S_name);
		 http.onreadystatechange = handleResponse;
       		 http.send(null);
    }

    function updateGlusrProfile() {

       // Open perl script for requests
       var email = document.getElementById ('email').value;
       var action = document.getElementById ('action').value;
       var subject = document.getElementById ('subject').value;
	var host = document.getElementById ('host').value;
	var referer_url = document.getElementById ('referer_url').value;
	var S_name = document.getElementById ('S_name').value;

	var glusr_id= document.getElementById ('glusr_id').value;
	if(action == 'update_email')
	{
		 var S_email = document.getElementById ('S_email').value;
		 if(document.getElementById ('email').value == '')
		 {
		 	alert("Kindly fill your email-id");
			document.getElementById ('email').focus();
			return (false);
		 }

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

		if(email == S_email)
		{
			alert("Kindly change your email-id");
			document.getElementById ('email').focus();
			return (false);
		}
		var modid=document.getElementById ('modid').value;
		document.body.style.cursor = 'wait';

		http.open('GET', '/cgi/updateprofile.cgi?glusr_id='+glusr_id+'&S_email='+email+'&action='+action+'&subject='+subject+'&host='+host+'&S_name='+S_name+'&modid='+modid+'&referer_url='+referer_url);
	}
	else if(action == 'update_email_pass')
	{
		 var S_email = document.getElementById ('S_email').value;
		 var S_pass = document.getElementById ('S_pass').value;
		 var modid=document.getElementById ('modid').value;
		 if(document.getElementById ('email').value == '')
		 {
		 	alert("Kindly fill your email-id");
			document.getElementById ('email').focus();
			return (false);
		 }

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

		if(email == S_email)
		{
			alert("Kindly change your email-id");
			document.getElementById ('email').focus();
			return (false);
		}
		if(S_pass == "" ) {
		alert("Kindly enter your Password.");
		document.getElementById ('S_pass').focus();
		return false;
		}
		else if(S_pass.length < 4) {
		alert("The Password should be atleast 4 characters long.");
		document.getElementById ('S_pass').focus();
		return false;
		}
		else if(S_pass.indexOf(" ") != -1) {
alert("Kindly enter your Password without any spaces in it.");
document.getElementById ('S_pass').focus();
return false;
		}
		//if(email == S_pass)
		
		document.body.style.cursor = 'wait';

		http.open('GET', '/cgi/updateprofile.cgi?glusr_id='+glusr_id+'&S_email='+email+'&S_pass='+S_pass+'&action='+action+'&subject='+subject+'&host='+host+'&S_name='+S_name+'&email='+S_email+'&modid='+modid+'&referer_url='+referer_url);
	}
	else
	{
		var S_pass = document.getElementById ('S_pass').value;
		var S_organization = document.getElementById ('S_organization').value;
		var S_website = document.getElementById ('S_website').value;
		var S_streetaddress= document.getElementById ('S_streetaddress').value;
		var S_city= document.getElementById ('S_city').value;
		var S_state= document.getElementById ('S_state').value;
		var S_pin= document.getElementById ('S_pin').value;
		var S_ccode_fax= document.getElementById ('S_ccode_fax').value;
		var S_acode_fax= document.getElementById ('S_acode_fax').value;
		var S_fax= document.getElementById ('S_fax').value;
		var modid=document.getElementById ('modid').value;

		var S_acode = '';
		var S_phone = '';
		var S_mobile = '';
		var S_cmobile = '';
		if(document.getElementById ('S_mobile'))
		{
			S_mobile= document.getElementById ('S_mobile').value;
		}
		if(document.getElementById ('S_acode'))
		{
			S_acode= document.getElementById ('S_acode').value;
		}
		if(document.getElementById ('S_phone'))
		{
			S_phone= document.getElementById ('S_phone').value;
		}
		if(document.getElementById ('S_cmobile'))
		{
			S_cmobile=document.getElementById ('S_cmobile').value;
		}

		S_organization=escape(S_organization);
		if(S_pass == "" ) {
		alert("Kindly enter your Password.");
		document.getElementById ('S_pass').focus();
		return false;
		}
		else if(S_pass.length < 4) {
		alert("The Password should be atleast 4 characters long.");
		document.getElementById ('S_pass').focus();
		return false;
		}
		else if(S_pass.indexOf(" ") != -1) {
alert("Kindly enter your Password without any spaces in it.");
document.getElementById ('S_pass').focus();
return false;
		}
		
		document.body.style.cursor = 'wait';

		http.open('GET', '/cgi/updateprofile.cgi?S_pass='+S_pass+'&S_organization='+S_organization+'&S_website='+S_website+'&S_streetaddress='+S_streetaddress+'&S_city='+S_city+'&S_state='+S_state+'&S_pin='+S_pin+'&S_ccode_fax='+S_ccode_fax+'&S_acode_fax='+S_acode_fax+'&S_fax='+S_fax+'&S_mobile='+S_mobile+'&glusr_id='+glusr_id+'&S_email='+email+'&subject='+subject+'&host='+host+'&S_name='+S_name+'&modid='+modid+'&referer_url='+referer_url);
	}
       http.onreadystatechange = handleResponse;
       http.send(null);
    }

    function handleResponse() {

       if(http.readyState == 4 && http.status == 200){
          // Text returned FROM the perl script
          var response = http.responseText; /*response 1 means true*/

          if(response > 0) {
             // UPDATE ajaxTest content
	     	//var el = document.getElementById('sub1');
		var action = document.getElementById ('action').value;

		if(action == 'update_email_pass' || action == 'update_email')
		{
			document.body.style.cursor = 'default';
			var ar = document.getElementById("master").getElementsByTagName("tr");
			ar[0].style.display = "none";
			ar[1].style.display = "none";

			if(action == 'update_email')
			{
				ar[2].style.display = "block";
			}
			else
			{
				ar[3].style.display = "block";
			}
		}
		else if(action == 'login')
		{
			document.body.style.cursor = 'default';
			var ar = document.getElementById("master").getElementsByTagName("tr");
			ar[0].style.display = "block";
			ar[1].style.display = "none";
		}
		else
		{
			if(response ==2)
			{
				document.getElementById("sub3").style.display = "block";
			}
			else
			{
				var ar = document.getElementById("master").getElementsByTagName("tr");
				ar[0].style.display = "none";
				ar[1].style.display = "none";
				ar[17].style.display = "block";
			}
			document.body.style.cursor = 'default';
		}
          }
	  else
	  {
		var action = document.getElementById ('action').value;
		if(action == 'update_email_pass' || action == 'update_email')
		{
			if(response < 0)
			{
				document.getElementById("sub3").style.display="block";
			}
			else
			{
				var ar = document.getElementById("master").getElementsByTagName("tr");
				ar[0].style.display = "block";
				ar[1].style.display = "block";
				ar[2].style.display = "none";
			}
		}
		else if(action == 'login')
		{
			document.getElementById("S_pass").value="";
			document.getElementById("sub3").style.display="block";
			document.getElementById("try_again").style.display="block";
		}
		document.body.style.cursor = 'default';
	  }

       }

    }

	function fax_afocus()
	{
		if(document.getElementById('S_acode_fax').value == 'Area Code')
		{
			
			document.getElementById('S_acode_fax').value = '';
		}
		document.getElementById('S_acode_fax').className='n_atxt1_th';
	}
	
	function fax_asettext()
	{
		if (document.getElementById('S_acode_fax').value=='')  
		{
			document.getElementById('S_acode_fax').value='Area Code';
			document.getElementById('S_acode_fax').className='n_atxt_th';
		}    
	}
	function fax_pfocus()
	{
		if(document.getElementById('S_fax').value == 'Fax Number')
		{
			
			document.getElementById('S_fax').value = '';
		}
		document.getElementById('S_fax').className='n_atxt1_th';
	}
	
	function fax_psettext()
	{
		if (document.getElementById('S_fax').value=='')  
		{
			document.getElementById('S_fax').value='Fax Number';
			document.getElementById('S_fax').className='n_atxt_th';
		}    
	}
	
	function phone_afocus()
	{
		if(document.getElementById('S_acode').value == 'Area Code')
		{
			
			document.getElementById('S_acode').value = '';
		}
		document.getElementById('S_acode').className='n_atxt1_th';
	}
	
	function phone_asettext()
	{
		if (document.getElementById('S_acode').value=='')  
		{
			document.getElementById('S_acode').value='Area Code';
			document.getElementById('S_acode').className='n_atxt_th';
		}    
	}
	function phone_pfocus()
	{
		if(document.getElementById('S_phone').value == 'Phone Number')
		{
			
			document.getElementById('S_phone').value = '';
		}
		document.getElementById('S_phone').className='n_atxt1_th';
	}
	
	function phone_psettext()
	{
		if (document.getElementById('S_phone').value=='')
		{
			document.getElementById('S_phone').value='Phone Number';
			document.getElementById('S_phone').className='n_atxt_th';
		}    
	}
	function mobile_pfocus()
	{
		if(document.getElementById('S_mobile').value == 'Mobile Number')
		{
			
			document.getElementById('S_mobile').value = '';
		}
		document.getElementById('S_mobile').className='n_atxt1_th';
	}
	
	function mobile_psettext()
	{
		if (document.getElementById('S_mobile').value=='')  
		{
			document.getElementById('S_mobile').value='Mobile Number';
			document.getElementById('S_mobile').className='n_atxt_th';
		}    
	}


function sendOfferToMyMail(serial)
{
	var offer=document.getElementById('ofrid'+serial).value;
	var spanID = 'sendMail'+offer;

	if(document.getElementById('send_ofr_email'))
	{
		var email=document.getElementById('send_ofr_email').value;
		if(email == ""  || email == 'Enter your email')
		{
			alert("Kindly enter your registered e-mail id.");

			document.getElementById('send_ofr_email').value='';
			document.getElementById('send_ofr_email').focus();
			return false;
		}
		else if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(email)))
		{
			alert("Invalid Email ID. Kindly enter the correct ID.");
			document.getElementById('send_ofr_email').focus();
			return false;
		}
	}
	
	var xmlHttp=ajaxFunction();
	if(xmlHttp)
	{
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{
				var temp=xmlHttp.responseText;


				document.getElementById(spanID).innerHTML='<DIV CLASS="tr-eto-p"><IMG SRC="/gifs/mail-new.gif" ALIGN="ABSMIDDLE" HSPACE="4" WIDTH="23" HEIGHT="16" ALT="Send this to My Mail "> '+temp+'</div>';
			}
			else
			{
				document.getElementById(spanID).innerHTML='<img src=/gifs/indicator.gif>&nbsp;Sending Mail...';
			}
		}
		xmlHttp.open("GET","/cgi/eto-send-to-mymail.mp?offer="+offer+"&send_email="+email,true);
		xmlHttp.send(null);
		return false;
	}

}

function forgotpwd()
{ 
	if(document.getElementById('forgetForm').style.display == "none")
	{
		document.getElementById('forgetForm').style.display = "block";
	}
	else
	{
		document.getElementById('forgetForm').style.display = "none";
	}
}

function del_mymail()
{
	if(document.getElementById('send_ofr_email').value == 'Enter your email')
	{
		document.getElementById('send_ofr_email').value='';
	}
}

// New Js for Forget Password
function Check_Login_New(flag)
{
	if(flag == 2)
	{
		var email_both = document.forgetPwdForm.email_both.value;

		if(document.forgetPwdForm.email_both.value == "" )
		{
			alert("Kindly enter your registered e-mail id.");
			document.forgetPwdForm.email_both.focus();
			return false;
		}

		if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.forgetPwdForm.email_both.value)))
		{
			alert("Invalid Email ID. Kindly enter the correct ID.");
			document.forgetPwdForm.email_both.focus();
			return (false);
		}
	}
	else if(flag == 3)
	{
		var email_both = document.getElementById('email_both').value;

		if(email_both == "" )
		{
			alert("Kindly enter your registered e-mail id.");
			document.getElementById('email_both').focus();
			return false;
		}

		if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(email_both)))
		{
			alert("Invalid Email ID. Kindly enter the correct ID.");
			document.getElementById('email_both').focus();
			return (false);
		}
	}
		
	var xmlHttp=ajaxFunction();
	if(xmlHttp)
	{
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{
				var temp = xmlHttp.responseText;
				if(temp == 'S')
				{
					document.getElementById('forget_error').innerHTML='<TABLE BORDER="0" WIDTH="94%" CELLPADDING="0" CELLSPACING="0" CLASS="tr-ferror" ALIGN="LEFT"><TR><TD CLASS="tr-etxt">Your Password has been sent to your Email ID.</TD></TR> </TABLE>';
					document.getElementById('login_email').value=email_both;
				}
				else
				{
					document.getElementById('forget_error').innerHTML='<TABLE BORDER="0" WIDTH="94%" CELLPADDING="0" CELLSPACING="0" CLASS="tr-ferror" ALIGN="LEFT"> <TR> <TD WIDTH="35" ALIGN="LEFT"><IMG SRC="/gifs/error-pbl.gif" WIDTH="27" HEIGHT="22"></TD> <TD CLASS="tr-etxt">'+temp+'</TD> </TR> </TABLE>';
				}
			}
			else
			{
				document.getElementById('forget_error').innerHTML='<TABLE BORDER="0" WIDTH="94%" CELLPADDING="0" CELLSPACING="0" CLASS="tr-ferror" ALIGN="LEFT"><TR><TD WIDTH="50" ALIGN="LEFT" CLASS="tr-etxt"><img src="/gifs/loading2.gif"><BR>Processing...</TD> </TR> </TABLE>';
			}
		}

		var str='/cgi/eto-usr-login.mp?email_both='+email_both+'&action=sendpass&modid=ETO';
		xmlHttp.open("GET",str,true);
		xmlHttp.send(null);
		return false;
	}
}

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

	if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.loginform.email.value))) 
	{
		alert("Invalid Email ID. Kindly enter the correct ID.");
		document.loginform.email.focus();
		return (false);
	}
	
	if(document.loginform.usr_pass.value == "" ) 
	{
		alert("Kindly enter your Password.");
		document.loginform.usr_pass.focus();
		return false;
	}
	
	if(document.loginform.usr_pass.value.length < 4) 
	{
		alert("The Password should be atleast 4 characters long.");
		document.loginform.usr_pass.focus();
		return false;
	}
	else 
	{
		return true;
	}
}

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

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

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


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


// New More Js
function tab1_new()
{
document.getElementById('form').style.display="block";
document.getElementById('form1').style.display="none";
document.getElementById('form2').style.display="none";
document.getElementById('form3').style.display="none";

document.getElementById('a').className="tr-opentab1";
document.getElementById('b').className="tr-closetab2";
document.getElementById('c').className="tr-closetab3";
document.getElementById('d').className="tr-closetab4";

}


function tab2_new()
{document.getElementById('form').style.display="none";
document.getElementById('form1').style.display="block";
document.getElementById('form2').style.display="none";
document.getElementById('form3').style.display="none";

document.getElementById('a').className="tr-closetab1";
document.getElementById('b').className="tr-opentab2";
document.getElementById('c').className="tr-closetab3";
document.getElementById('d').className="tr-closetab4";

}


function tab3()
{
document.getElementById('form').style.display="none";
document.getElementById('form1').style.display="none";
document.getElementById('form2').style.display="block";
document.getElementById('form3').style.display="none";

document.getElementById('a').className="tr-closetab1";
document.getElementById('b').className="tr-closetab2";
document.getElementById('c').className="tr-opentab3";
document.getElementById('d').className="tr-closetab4";
}


function tab4()
{document.getElementById('form').style.display="none";
document.getElementById('form1').style.display="none";
document.getElementById('form2').style.display="none";
document.getElementById('form3').style.display="block";

document.getElementById('a').className="tr-closetab1";
document.getElementById('b').className="tr-closetab2";
document.getElementById('c').className="tr-closetab3";
document.getElementById('d').className="tr-opentab4";

}

// function offershow()
// {
// if(document.getElementById('offers').className=="offeroff")
// 	{
// document.getElementById('offers').className="tr-offeron";
// 	}
// 
// else
// 	{
// document.getElementById('offers').className="tr-offeroff";
// 	}
// }

// Expert form
function bhw1()
{
	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.getElementsByTagName("body")[0].scrollHeight;
	var totalheight= intElemScrollHeight+20;
	
	var bwidth= myWidth-22;
	document.getElementById('tableheight').style.height=myHeight+'px';
	document.getElementById('divheight').style.height=h+'px';
	document.getElementById('message1').style.height=totalheight+'px';

	if (navigator.appName == 'Microsoft internet Explorer')
	{
		document.getElementById('tableheight').style.width=myWidth+'px';
	}
	else
	{
		document.getElementById('tableheight').style.width=bwidth+'px';

	}
}

function expert_form_display()
{
	var user_name = document.getElementById('user_name').value;
	var user_comp = document.getElementById('user_comp').value;
	var user_email = document.getElementById('user_email').value;

	var user_ph_country = document.getElementById('user_ph_country').value;
	var user_ph_area = document.getElementById('user_ph_area').value;
	var user_ph_no = document.getElementById('user_ph_no').value;

	var feed_ofr_type = '';
	if(document.getElementById('feed_ofr_type'))
	{
		feed_ofr_type = document.getElementById('feed_ofr_type').value;
	}

	document.getElementById('thankyou_message').innerHTML='';
	show_alert('expert_form');

	document.getElementById('expert_form').innerHTML = '<form name="epert_form" method="post" onsubmit="return check_expert_form(1);"><INPUT TYPE="hidden" NAME="feed_ofr_type" id="feed_ofr_type" value="'+feed_ofr_type+'"><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%"> <TR> <TD CLASS="tr-frmtxt" ALIGN="RIGHT" WIDTH="110"><FONT COLOR="#FF0000">* </FONT>Your Name:</TD> <TD> <INPUT TYPE="TEXT" NAME="feed_name" id="feed_name" value="'+user_name+'" CLASS="tr-txtbox"> </TD> </TR> <TR> <TD CLASS="tr-frmtxt" ALIGN="RIGHT">Company Name:</TD> <TD> <INPUT TYPE="TEXT" NAME="feed_comp" id="feed_comp" value="'+user_comp+'" CLASS="tr-txtbox"> </TD> </TR> <TR> <TD CLASS="tr-frmtxt" ALIGN="RIGHT"><FONT COLOR="#FF0000">* </FONT>Email-id:</TD> <TD> <INPUT TYPE="TEXT" NAME="feed_email" id="feed_email" value="'+user_email+'" CLASS="tr-txtbox"> </TD> </TR> <TR> <TD CLASS="tr-frmtxt" ALIGN="RIGHT">Phone:</TD> <TD VALIGN="TOP"> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0"> <TBODY> <TR> <TD CLASS="tr-lastnam-fr">Country Code</TD> <TD CLASS="tr-lastname1-fr">Area Code</TD> <TD CLASS="tr-lastname2-fr">Phone Number</TD> </TR> <TR> <TD><INPUT MAXLENGTH="20" SIZE="10" name="feed_ph_country" id="feed_ph_country" CLASS="tr-box-bo" value="'+user_ph_country+'"></TD> <TD COLSPAN="1"><INPUT MAXLENGTH="20" SIZE="11" name="feed_ph_area" id="feed_ph_area" CLASS="tr-box-bo1" value="'+user_ph_area+'"></TD> <TD COLSPAN="1"><INPUT MAXLENGTH="20" SIZE="11" name="feed_ph_no" id="feed_ph_no" CLASS="tr-box-bo2" value="'+user_ph_no+'"></TD> </TR></TBODY> </TABLE></TD> </TR> <TR> <TD CLASS="tr-frmtxt" ALIGN="RIGHT"><FONT COLOR="#FF0000">* </FONT>Feedback Type:</TD> <TD><SELECT name="feed_typ" CLASS="tr-txtbox" id="feed_typ"> <OPTION value="">----Select Feedback Type ----</OPTION> <OPTION value="Feedback">Feedback</OPTION> <OPTION value="Complaint">Complaint</OPTION> <OPTION value="General Suggestions"> General Suggestions</OPTION> <OPTION value="Need PBL Help">Need PBL Help</OPTION></SELECT></TD> </TR> <TR> <TD CLASS="tr-frmtxt" ALIGN="RIGHT" VALIGN="TOP" STYLE="padding-top:10px;"><FONT COLOR="#FF0000">* </FONT>Message: </TD> <TD><TEXTAREA STYLE="width:320px; height:140px; margin-top:6px; margin-bottom:6px;" NAME="feed_mesg" id="feed_mesg"></TEXTAREA></TD> </TR> <TR> <TD ALIGN="CENTER" COLSPAN="2"> <span id="submit_message"> <INPUT TYPE="submit" NAME="Submit1" CLASS="tr-button" VALUE="Submit"> </span> <span id="expert_message"></span> </TD> </TR> </TABLE></FORM>';
}

function check_expert_form(serial)
{
	var feed_email = document.getElementById('feed_email').value;
	var feed_name = document.getElementById('feed_name').value;
	var feed_ph_no = document.getElementById('feed_ph_no').value;
	var feed_ph_country = document.getElementById('feed_ph_country').value;
	var feed_ph_area = document.getElementById('feed_ph_area').value;
	var feed_comp = document.getElementById('feed_comp').value;
	var feed_mesg = document.getElementById('feed_mesg').value;
	var feed_typ = document.getElementById('feed_typ').value;
	var offer = document.getElementById('ofrid'+serial).value;
	var feed_ofr_type = document.getElementById('feed_ofr_type').value;


	if(feed_name == "")
	{
		alert("Kindly enter your First Name.");
		document.getElementById('feed_name').focus();
		return false;
	}

	if(feed_email == "")
	{
		alert("Kindly enter your registered e-mail id.");
		document.getElementById('feed_email').focus();
		return false;
	}
	else if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(feed_email)))
	{
		alert("Invalid Email ID. Kindly enter the correct ID.");
		document.getElementById('feed_email').focus();
		return false;
	}

	if(feed_ph_no)
	{
		if(feed_ph_country == '')
		{
			alert("Kindly enter your Country Code.");
			document.getElementById('feed_ph_country').focus();
			return false;
		}
	}

	if(feed_typ == "")
	{
		alert("Kindly enter your feedback.");
		document.getElementById('feed_typ').focus();
		return false;
	}

	feed_mesg = feed_mesg.replace(/^\s+/g, '').replace(/\s+$/g, '');
	document.getElementById('feed_mesg').value=feed_mesg;

	if(feed_mesg == "")
	{
		alert("Please fill in your Message.");
		document.getElementById('feed_mesg').focus();
		return false;
	}
	if(feed_mesg.length > 2000) {
		alert("Your Message should not be more than 2000 characters.");
		document.getElementById('feed_mesg').focus();
		return false;
	}

	var xmlHttp=ajaxFunction();
	if(xmlHttp)
	{
		xmlHttp.onreadystatechange=function()
		{
			show_alert_off('submit_message');
			if(xmlHttp.readyState==4)
			{
				var temp = xmlHttp.responseText;
				if(temp == '1')
				{
					show_alert_off('expert_form');
					document.getElementById('thankyou_message').innerHTML='<div align="center" CLASS="tr-frmtxt"> <div CLASS="tr-frmtxt" style="font-size:18px;"><img src="/gifs/thanks1.gif" align="absmiddle" height="35" hspace="5" vspace="1" width="35" style="color:red;">Thank You!</div><br><p CLASS="tr-frmtxt">Thank you so much for sending your enquiry to us.</p><p CLASS="tr-frmtxt">Our Team will review your enquiry <BR> and revert back to you very soon...</p> </div>';
				}
				else
				{
					show_alert('submit_message');
					document.getElementById('expert_message').innerHTML='<B CLASS="tr-frmtxt" style="color:red;">Sorry, Some Error Occurs ...</B>';
				}
			}
			else
			{
				document.getElementById('expert_message').innerHTML='<B CLASS="tr-button"><img src="/gifs/loading2.gif"></B>';
			}
		}

		var str='/feedback.mp?encode=1&feed_email='+feed_email+'&feed_name='+feed_name+'&feed_mesg='+escape(feed_mesg)+'&feed_typ='+feed_typ+'&feed_comp='+feed_comp+'&offer='+offer+'&feed_ph_no='+feed_ph_no+'&feed_ph_country='+feed_ph_country+'&feed_ph_area='+feed_ph_area+'&feed_ofr_type='+feed_ofr_type;
		xmlHttp.open("GET",str,true);
		xmlHttp.send(null);
		return false;
	}
}

// Purchase Lead
function Pur_Buy_Lead(form_serial)
{
	var custAvCredit=Math.ceil(document.getElementById('custAvCredit').innerHTML);
	var custUsedCredit=Math.ceil(document.getElementById('custUsedCredit').innerHTML);
	var totalPurchasedBuyLeads=Math.ceil(document.getElementById('totalPurchasedBuyLeads').innerHTML);
	var creditsAfterDisc=Math.ceil(document.getElementById('creditsAfterDisc').value);
	
	var offer=document.getElementById('ofrid1').value;
	var usr_paid_serv=document.getElementById('usr_paid_serv').value;

	if(usr_paid_serv == 2)
	{
		var path = '/cgi/eto-subscription.mp?offer='+offer;
		var temp1='<strong>Currently You are subscribed to Supplier Introduction Service only. <BR> To purchase this Buy Lead, you need to subscribe for PBL service separately<BR><A HREF='+path+'>Click here to send your request</A></strong>';
		
		document.getElementById('pur_buy_status').innerHTML=temp1; /*tab1*/
		document.getElementById('div_resp_status').className="tr-ld-nor1";
		document.getElementById('div_resp_status').innerHTML=temp1;/*tab2*/
		return false;
	}

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

				var my_array=xmlHttp.responseText.split("::::");
				var temp = my_array[0];
				var temp1 = my_array[1];
				var temp2= my_array[2];

				if(temp == 1)
				{
					document.getElementById('buyers_detail').innerHTML=temp2;
					document.getElementById('pur_buy_status').className="tr-bor-box";
					document.getElementById('pur_buy_status').innerHTML=' <DIV CLASS="tr-ld-bor"><P>Congratulations!</P><B>You have successfully purchased <BR>this Buy Lead </B></DIV><DIV ALIGN="LEFT" CLASS="tr-ar2-g" STYLE="cursor:pointer;" ONCLICK="tab2_new();Response_display();"><B CLASS="tr-wh"><U>Submit Your Response</U></B><BR> And Contact this Buyer</DIV>';

					if(form_serial == 1)
					{
						document.getElementById('div_resp_status').style.display = "none";
					}
					else
					{
						document.getElementById('div_resp_status').className="tr-ld-nor1";
						document.getElementById('div_resp_status').innerHTML = '<B>Congratulations!</B><BR> You have successfully purchased this Buy Lead. Fill your respones below and contact this Buyer';
					}
					document.getElementById('submit_mesg').className="tr-b-tton";
					document.getElementById('submit_mesg').disabled = false;
					document.getElementById('mesg').disabled = false;
					document.getElementById('pur_status').value=1; /*pur_status*/


					/*Update purchase History*/
					custAvCredit = custAvCredit-creditsAfterDisc;
					custUsedCredit = custUsedCredit+creditsAfterDisc;
					totalPurchasedBuyLeads = totalPurchasedBuyLeads+1;

					document.getElementById('custAvCredit').innerHTML=custAvCredit;
					document.getElementById('custAvCredit1').innerHTML=custAvCredit;
					document.getElementById('custUsedCredit').innerHTML=custUsedCredit;
					document.getElementById('totalPurchasedBuyLeads').innerHTML=totalPurchasedBuyLeads;
					document.getElementById('totalPurchasedBuyLeads1').innerHTML=totalPurchasedBuyLeads;
					/*Update purchase History*/

					if(document.getElementById('return_gatway'))
					{
						document.getElementById('return_gatway').style.display="none";
					}

					// Subscription Buy Lead
					if(document.getElementById('sub_buy_lead'))
					{
						document.getElementById('sub_buy_lead').innerHTML='';
					}

					if(document.getElementById('sub_buy_lead1'))
					{
						document.getElementById('sub_buy_lead1').innerHTML='';
					}
					// Subscription Buy Lead
				}
				else
				{
					if (temp1 == "undefined")
					{
						temp1 = 'Some Error Occured, Please try again.'
					}

					if(temp == 2) //already purchased
					{
						document.getElementById('pur_buy_status').innerHTML='<DIV CLASS="tr-ld-bor">'+temp1+'</DIV><DIV ALIGN="LEFT" CLASS="tr-ar2-g" STYLE="cursor:pointer;" ONCLICK="tab2_new();Response_display();"><B CLASS="tr-wh"><U>Submit Your Response</U></B><BR> And Contact this Buyer</DIV>'; /*tab1*/
						
						document.getElementById('submit_mesg').className="tr-b-tton";
						document.getElementById('submit_mesg').disabled = false;
						document.getElementById('mesg').disabled = false;
						document.getElementById('pur_status').value=1; /*pur_status*/


						/*Update purchase History*/
						custAvCredit = custAvCredit-creditsAfterDisc;
						custUsedCredit = custUsedCredit+creditsAfterDisc;
						totalPurchasedBuyLeads = totalPurchasedBuyLeads+1;
	
						document.getElementById('custAvCredit').innerHTML=custAvCredit;
						document.getElementById('custAvCredit1').innerHTML=custAvCredit;
						document.getElementById('custUsedCredit').innerHTML=custUsedCredit;
						document.getElementById('totalPurchasedBuyLeads').innerHTML=totalPurchasedBuyLeads;
						document.getElementById('totalPurchasedBuyLeads1').innerHTML=totalPurchasedBuyLeads;
						/*Update purchase History*/
	
						if(document.getElementById('return_gatway'))
						{
							document.getElementById('return_gatway').style.display="none";
						}
	
						// Subscription Buy Lead
						if(document.getElementById('sub_buy_lead'))
						{
							document.getElementById('sub_buy_lead').innerHTML='';
						}
	
						if(document.getElementById('sub_buy_lead1'))
						{
							document.getElementById('sub_buy_lead1').innerHTML='';
						}
						// Subscription Buy Lead
					}
					else
					{
						document.getElementById('pur_buy_status').innerHTML='<DIV CLASS="tr-ld-bor">'+temp1+'</DIV>'; /*tab1*/
					}

					document.getElementById('div_resp_status').innerHTML=' <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" STYLE="height:42px;"> <TR> <TD BGCOLOR="#ffffdb" width="800px;" VALIGN="top"> <DIV CLASS="tr-ld-bor"><STRONG>'+temp1+'</STRONG></div> <BR></TD> </TR></TABLE>';/*tab2*/
				}
			}
			else
			{
				document.getElementById('pur_buy_status').innerHTML='<div align="center" style="width:80px;padding:5px;margin:40px 0px 0px 80px"><img src="/gifs/indicator.gif"><BR>processing...</div>'; /*tab1*/

				document.getElementById('div_resp_status').innerHTML=' <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" STYLE="height:42px;"> <TR> <TD BGCOLOR="#ffffdb" width="800px;" VALIGN="top"><div align="center" style="width:60px;padding:5px;margin:10px 0px 0px 250px"><img src="/gifs/indicator.gif"><BR>processing...</div></TD> </TR></TABLE>';/*tab2*/
			}
		}

		var str='/details.mp?offer='+offer+'&action=purchase&buy_ajax=1';
		xmlHttp.open("GET",str,true);
		xmlHttp.send(null);
		return false;
	}
}

// Response Lead
function Response_display(obj)
{
	if(obj == 'Y')
	{
		show_alert_off('div_resp_status');
		show_alert_off('divThankyou');
		show_alert('response_thankyou');
	}
	else
	{
		show_alert_off('otherBuyLeads');
		show_alert_off('response_thankyou');
		show_alert('divThankyou');
	}
}

function Response(obj,serial)
{
	var offerID = document.getElementById('ofrid'+serial).value;
	var pur_status = document.getElementById('pur_status').value;
	var MyForm = eval('document.'+obj);
	
	if(MyForm.mesg.value == '')
	{
		alert("Please fill your response");
		MyForm.mesg.focus();
		return false;
	}
	
	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;
	}

	var sendmeCC = document.getElementById('sendmeCC').value;
	if(pur_status == 0)
	{
		alert("Please Purchase the Buy Lead first to response!");
		MyForm.mesg.focus();
		return false;
	}

	Response_display('Y');

	var xmlHttp=ajaxFunction();
	if(xmlHttp)
	{
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{
				var temp =xmlHttp.responseText;
				document.getElementById('response_thankyou').innerHTML='<BR><div align="center" CLASS="tr-ct-h"><B>'+temp+'</B></div><BR>';
				show_alert('otherBuyLeads');
			}
			else
			{
				document.getElementById('response_thankyou').innerHTML='<BR><BR><BR><BR><BR><div align="center"><img src="/gifs/loading2.gif"><BR><BR>Sending Response.....</div><BR><BR><BR><BR><BR><BR><BR>';
			}
		}
		var str="/cgi/eto-response.mp?popup=1&offerID="+offerID+"&mesg="+escape(message)+"&encode=1&sendmeCC="+sendmeCC;
		
		xmlHttp.open("GET",str,true);
		xmlHttp.send(null);
		return false;
	}
}

function characterLimit(obj)
{
	var MyForm = eval('document.'+obj);
	var characters = MyForm.mesg.value;
	
	document.getElementById('charUpdate').innerHTML = 2000-characters.length;
	return false;
}


var myWidth = 0, myHeight = 0;

function pagesize()
{
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;
  }


if (myWidth >= 1220 && document.getElementById('maindiv'))
	{
		document.getElementById('maindiv').className="tr-f_x3";
		document.getElementById('intable').className="tr-fix_in";
		document.getElementById('righttable').className="tr-tl-left1";
		if (document.getElementById('mesg'))
		{
	document.getElementById('mesg').className="tr-eto-txt1";
	}
	}

else if(document.getElementById('maindiv'))
	{
		document.getElementById('maindiv').className="tr-f_x1";
		document.getElementById('intable').className="tr-f_x";
		document.getElementById('righttable').className="tr-tl-left";

	if (document.getElementById('mesg'))
		{
	document.getElementById('mesg').className="tr-eto-txt";
	}
	

	}
}

function addEvent( obj, type, fn ){ 
   if (obj.addEventListener){ 
	  obj.addEventListener( type, fn, false );
   }
   else if (obj.attachEvent){ 
	  obj["e"+type+fn] = fn; 
	  obj[type+fn] = function(){ obj["e"+type+fn]( window.event ); } 
	  obj.attachEvent( "on"+type, obj[type+fn] ); 
   } 

}
addEvent(window, 'load', pagesize);
addEvent(window, 'resize', pagesize);


/*Add New Css for New Reg PBL Form*/
function txt()
{
	if(document.ModReg.ph_area.value == 'Area Code')
	{
		
		document.ModReg.ph_area.value = '';
	}
	document.ModReg.ph_area.className='n_atxt1';	
}
    
function settextnew()
{
	if (document.ModReg.ph_area.value=='')
	{
		document.ModReg.ph_area.value='Area Code';
		document.ModReg.ph_area.className='n_atxt';
	}
}



function txt1()
{
	if(document.ModReg.ph_no.value=='Phone Number')
	{
		document.ModReg.ph_no.value='';
		document.ModReg.ph_no.className='n_atxt1';
	}
}
    
function settext1new()
{
	if (document.ModReg.ph_no.value=='')  {
		document.ModReg.ph_no.value='Phone Number';
	document.ModReg.ph_no.className='n_atxt';

}    
}	



function txt2()
{
if
(
document.ModReg.mobile.value=='Mobile Number')	{
document.ModReg.mobile.value='';
document.ModReg.mobile.className='n_atxt1';

}		
}
    
function settext2new()
{
	if (document.ModReg.mobile.value=='')  
	{
		document.ModReg.mobile.value='Mobile Number';
		document.ModReg.mobile.className='n_atxt';
	}
}

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

function hlphide()
{
	document.getElementById('phonehlp').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;
}


/*sell offer User Java script*/


/* Respnose phone & mobile */

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

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

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

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

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

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

function tab5()
{document.getElementById('new').style.display="none";
document.getElementById('new1').style.display="block";
}


function tab6()
{document.getElementById('new').style.display="block";
document.getElementById('new1').style.display="none";
}

function pagesize1()
{
	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;
	}

	if (myWidth >= 1220 && document.getElementById('maindiv_sell'))
	{
		document.getElementById('r1').className="s_r2";
		document.getElementById('l1').className="s_l2";
	}
	else if(document.getElementById('maindiv_sell'))
	{	
		document.getElementById('r1').className="s_r1";
		document.getElementById('l1').className="s_l";
	}
}

addEvent(window, 'load', pagesize1);
addEvent(window, 'resize', pagesize1);

function showBuyForm()
{
	var xmlHttp=ajaxFunction();
	if(xmlHttp)
	{
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{
				var temp =xmlHttp.responseText;
				document.getElementById('show_buy_form').innerHTML=temp;
			}
			else
			{
				document.getElementById('show_buy_form').innerHTML='<div align="center" style="margin-top:200px;margin-bottom:200px;"><img src="/gifs/loading2.gif"><BR><BR>Processing.....</div>';
			}
		}
		var str="/cgi/eto-buy-form.mp";
		
		xmlHttp.open("GET",str,true);
		xmlHttp.send(null);
		return false;
	}
}

function getheight(id)
{
	var div1 = Math.ceil(document.getElementById(id).scrollHeight);
	var count = Math.floor(div1/100);
	document.getElementById('google_right_cnt').value=count;
}

