/* ##################### */
function checkLoginOnFocus() {
	
	if(document.getElementById("username").value == "User Name")
		document.getElementById("username").value = "";
		
	if(document.getElementById("password").value == "******")
		document.getElementById("password").value = "";
}

function checkLoginOnBlur() {
	
	if(document.getElementById("username").value == "")
		document.getElementById("username").value = "User Name";
		
	if(document.getElementById("password").value == "")
		document.getElementById("password").value = "******";
}


function clearValues(theForm)			//empty all field in a form
{
	for(var i=0;i<theForm.elements.length;i++)
	{
		var e = theForm.elements[i];
		if(e.type!="submit" && e.type!="button")
		e.value = "";
		if(e.type=='checkbox') e.checked=false;
	}
	return false;
}

/*general functions to check the users email, alphabets, name, password, remove spaces form the Name through trim() etc..*/

function trim (strVar) { 
	if(strVar.length >0)
	{
		while(strVar.charAt(0)==" ") 
			strVar=strVar.substring(1,strVar.length); 
		while(strVar.charAt(strVar.length-1)==" ") 
			strVar=strVar.substring(0,strVar.length-1); 
	}
	return strVar; 
}

function isNotAlphabets(str){
	for (var i = 0; i < str.length; i++)
	{
		var ch = str.substring(i, i + 1);
		if((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch)) 
		{
			return true;
		}
	}
	return false;
}

function isNotNumeric(str){
	for (var i = 0; i < str.length; i++)
	{
		var ch = str.substring(i, i + 1);
		if((ch < '0' || '9' < ch)) 
		{
			if(ch == "-" || ch == ".") continue;
			return true;
		}
	}
	return false;
}

/*To check the Login ID of the User*/

function isNotID(str){
	for (var i = 0; i < str.length; i++)
	{
		var ch = str.substring(i, i + 1);
		if((ch < '0' || '9' < ch) && ((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch))) 
		{
			if(ch == "_") continue;
			return true;
		}
	}
	return false;
}

function isValidEmail(emailid){		
	var l=emailid.length;
	if(l==0)
	{
		return false;	
	}
	if(l!=0)
	{
		var a=emailid.indexOf('@');
		var d=emailid.lastIndexOf('.');
		var str1=emailid.substr(0,a);
		var str2=emailid.substr(a+1,d-a-1);
		var str3=emailid.substr(d+1,l);
		var len1=str1.length;
		var len2=str2.length;
		var len3=str3.length;
		if(a<0 || d<2)
		{
			alert ("Check for missing '@' or '.' ");
			return false;
		}
		else if (a>d)
		{
			alert ("Invalid email. Please enter correct email address");
			return false;
		}				
		if (len1<=1 || len2<=1 || len3 <=1)
		{
			alert ("Invalid email. Please enter correct email address");
			return false;
		}				
	}
	return true;
}

/*Used in All Cp Modules*/
function checkAll(checked)
{
	for(var i=0;i<document.removeForm.elements.length;i++)
	{
		var e = document.removeForm.elements[i];
		if(e.type == "checkbox") e.checked = checked;
	}
}

function checkAllperm(checked)
{
	for(var i=0;i<document.showPermFrm.elements.length;i++)
	{
		var e = document.showPermFrm.elements[i];
		if(e.type == "checkbox") e.checked = checked;
	}
}

function checkAllperm1(checked)
{
	for(var i=0;i<document.permFrm.elements.length;i++)
	{
		var e = document.permFrm.elements[i];
		if(e.type == "checkbox") e.checked = checked;
	}
}

function checkCreateUser(membersForm)
{
//Members Id validation
	var member = trim(document.membersForm.loginId.value);
	if(member.length == 0)
	{
		alert("Please enter Login ID");
		document.membersForm.loginId.focus();
		return false;
	}
	var member = document.membersForm.loginId.value;
	if(member.length < 5)
	{
		alert("Login ID should be atleast Five(5) Characters!");
		document.membersForm.loginId.focus();
		return false;
	}
	if(isNotID(member))
	{
		alert("Invalid Characters in Login ID");
		document.membersForm.loginId.focus();
		return false;
	}
  //Password Validation
	var password = trim(document.membersForm.password.value);
	if(password.length == 0)
	{
		alert("Please enter Password");
		document.membersForm.password.focus();
		return false;
	}
	var password = document.membersForm.password.value;
	if(password.length < 6)
	{
		alert("Password should be atleast Six(6) Characters!");
		document.membersForm.password.focus();
		return false;
	}		  
	if(isNotID(password))
	{
		alert("Invalid Characters in Password");
		document.membersForm.password.focus();
		return false;		  
	}
	//Confirm Password
	var confirm_password = document.membersForm.confirm_password.value;
	if(password != confirm_password)		  		  
	{
		alert("Password & Confirm Password mismatch!");
		document.membersForm.confirm_password.focus();
		return false;		  
	}
	 //First Name
	var fname = trim(document.membersForm.name.value);
	if(fname.length == 0)
	{
		alert("Please enter Name");
		document.membersForm.name.focus();
		return false;
	}
	//Address
	var address_1 = trim(document.membersForm.address_1.value);
	if(address_1.length == 0)
	{
		alert("Please enter Street Address - 1");
		document.membersForm.address_1.focus();
		return false;
	}
	//Country		  		  
	var country = document.membersForm.country.value;
	if(country.length == 0)
	{
		alert("Please Select Users Country");
		document.membersForm.country.focus();
		return false;
	}
	//Email		  
	var email_1 = trim(document.membersForm.email_1.value);
	if(email_1.length == 0)
	{
		alert("Please enter Email - 1");
		document.membersForm.email_1.focus();
		return false;
	}
	if(isValidEmail(email_1) == 0)
	{
		document.membersForm.email_1.focus();
		return false;		  
	}		  		  		  
	return true;
}

/* #############Search keyword######################## */

function checkfrmedit(chk)
{
	if(chk.keyword.value == "")
	{
		alert("Please enter keyword to search");
		chk.keyword.focus();
		return false;
	}	
}

/*############### Delete member */

function deleteAlert1()
{
	var i=0;
	var total = 0;
	var msg = "";

	dml=frmdelStatus;
	len=dml.elements.length;
	if(len)
	{
		for (i=0; i<len; i++) 
		{
	  		ss = dml.elements[i].name
  			//s = ss.substr(0, 6);
	     	if (dml.elements[i].type == "checkbox") 
	     		if(dml.elements[i].checked== true)
        			total=total+1;
   		}
   		if(total >0)
			msg = msg + 'Do You Like to remove ' + total +' records ?';
		else
		{
			alert("Please check the items to remove !");
			return false;
		}
		if(msg.length >0)
		{
			var flag;
            flag = confirm(msg + " \n If Yes Press \"OK\" else Press \"Cancel\".");
            if(flag == true)
            return true;
		}
	}
	return false;
}

/*#########  Delete in the CP folder files*/

function deleteAlert(theForm)
{
	 var records = theForm.records.value;
     var total = 0;
     var msg = "";
     if(records>0)
     {
          for(i=0; i<theForm.length; i++)
          {
               e=theForm.elements[i];
               name = e.name;
               name = name.substr(0,4);
               if (e.type=='checkbox' && name == "item")
                    if(eval('e.checked') == true)
                         total= total+1;
          }
          if(total >0)
               msg = msg + 'Do You Like to remove ' + total +' records ?';
          else
          {
               alert("Please check the items to remove !");
               return false;
          }
          if(msg.length >0)
          {
               var flag;
               flag = confirm(msg + " If Yes Press \"OK\" else Press \"Cancel\".");
               if(flag == true)
               return true;
          }
     }
	 //alert("You can not delete items");
     return false;
}


//###################
function bookmark()
{
	window.external.AddFavorite(url,title);
}

// JavaScript Document
function changecolor(row)
{
	row.className='blue';
}

function restorecolor(row)
{
	row.className='white';
}

var pop='';

function openwin(nm,width,height) {
	var name=nm;
	if (pop && !pop.closed) {
		pop.close();
	}
	pop=eval("window.open('"+name+"','NewWIN','chrome[4],toolbar=no,left=5,top=5,width="+width+",height="+height+",directories=no,menubar=no,SCROLLBARS=yes,left=2,right=2')");
	if (!pop.opener) popUpWin.opener = self;
}

function closewin()
{
	window.close();
}

function checkPassword(chk)
{
	if(chk.userName.value.length==0)
	{
		alert("Please Select a User");
		chk.userName.focus();
		return false;
	}
	if(chk.npass.value.length==0)
	{
		alert("Please type new password");
		chk.npass.focus();
		return false;
	}
	if(chk.rpass.value.length==0)
	{
		alert("Please Re-Type the new password");
		chk.rpass.focus();
		return false;
	}
	if(chk.npass.value!=chk.rpass.value)
	{
		alert("New password and Re-Type password does not match");
		chk.npass.value="";
		chk.rpass.value="";
		chk.npass.focus();
		return false;
	}
}

function checkpass(form1)
{
	if(form1.username.value.length==0)
	{
		alert ("Please Enter Username!!!");
		form1.username.focus();
		return false;
	}
	if(form1.username.value.length<4)
	{
		alert ("Please Enter Atleast 4 Characters in Login ID!!!");
		form1.login.focus();
		return false;
	}
	if(form1.password.value.length==0)
	{
		alert ("Please Enter Valid Password !!!");
		form1.password.focus();
		return false;
	}
	if(form1.password.value.length<4)
	{
		alert ("Please Enter Atleast 4 Characters in Password!!!");
		form1.password.focus();
		return false;
	}
	return true;
}


function addUser(chk)
{
	if(chk.userName.value.length==0)
	{
		alert("Please type a user name");
		chk.userName.focus();
		return false;
	}

	if(chk.npass.value.length==0)
	{
		alert("Password field can not be left blank");
		chk.npass.focus();
		return false;
	}
	if(chk.rpass.value.length==0)
	{
		alert("Re-Type Password field can not be left blank");
		chk.rpass.focus();
		return false;
	}
	if(chk.npass.value!=chk.rpass.value)
	{
		alert("Password and Re-Type password does not match");
		chk.npass.value="";
		chk.rpass.value="";
		chk.npass.focus();
		return false;
	}
}

function checkLogin(chk)
{
	if(chk.userName.value.length==0)
	{
		alert("User Name can not be left blank");
		chk.userName.focus();
		return false;
	}
	if(chk.password.value.length==0)
	{
		alert("Password can not be left blank");
		chk.password.focus();
		return false;
	}
}	

function autoAlertCheck(theForm){
	//Email
	var email = theForm.email.value;
	var name = theForm.name.value;
	if(name.length == 0)
	{
	   alert("Please enter Name");
	   theForm.name.focus();
	   return false;
	}
	if(name.length < 3)
	{
	   alert("Please Atleast THREE (3) characters.");
	   theForm.name.focus();
	   return false;
	}
	if(email.length == 0)
	{
	   alert("Please enter Email ID");
	   theForm.email.focus();
	   return false;
	}
	if(isValidEmail(email) == 0)
	{
	   theForm.email.focus();
	   return false;		  
	}
	return true;
}
function validEmail(str)
{
	mailRE = new RegExp( );
	mailRE.compile( '^[\._a-z0-9-]+@[\.a-z0-9-]+[\.]{1}[a-z]{2,4}$', 'gi' );
	return (mailRE.test(str));
}
function deleteAlert2(theForm)
{
	 var records = theForm.records.value;
     var total = 0;
     var msg = "";
     if(records>0)
     {
          for(i=0; i<theForm.length; i++)
          {
               e=theForm.elements[i];
               if (e.type=='checkbox')
                    if(eval('e.checked') == true)
                         total= total+1;
          }
          if(total >0)
               msg = msg + 'Do You Like to remove ' + total +' records ?';
          else
          {
               alert("Please check the items to remove !");
               return false;
          }
          if(msg.length >0)
          {
               var flag;
               flag = confirm(msg + " If Yes Press \"OK\" else Press \"Cancel\".");
               if(flag == true)
               return true;
          }
     }
	 //alert("You can not delete items");
     return false;
}


function checkpass1(form)
{
	if(form2.searchtxt.value.length==0)
	{
		alert ("Search Text Should not be Empty!!!");
		form2.searchtxt.focus();
		return false;
	}
	if(form2.searchtxt.value.length<3)
	{
		alert ("Please!\n\nEnter Atleast 3 Characters!!!");
		form2.searchtxt.focus();
		return false;
	}
	return true;
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
	alert(theURL)
	window.open(theURL,winName,features);
}
/* CONVERT DATA INTO STANDARD CASE START*/
var first_nmchk = "Y";
var first_subchk = "Y";
function chk_case(f_name){
	var str = "";
	var matchstr = "";
	var chk_value = "N";
	var modified1 = "N";
	var b_str = eval("document.catForm."+f_name+".value");
	var abbr = ["MP3","LCD","USB","DVD","TV","ATV","LED","PC","CD","PVC","TFT","FM","HDD","GSM","DVR","DC","CCTV","HP","PP","3D","EVA","CDMA","CCD","PU","RC","CRT","VCD","PE","RF","ID","AC","TFT-LCD","PDA","BBQ","VGA","UV","PDP","PCB","PET","MP4","GPS","UPS","OEM","AB","CNC","PTFE","CPU","IC","LV","EEC","IR","SIM","IQF","TL","NZ","IP","EL","OLED","SD","SMD","MF","TN","PCI","ADSL","RO","CD-R","PCMCIA","LG","PS","MOP","HDPE","LPG","LAN","CE","CMOS","ATX","MPEG4","PVA","VAIO","HMS","NYA","AV","HD","ATI","IBM","PTC","PIN","PS2","ECG","AAA","4WD","PCS","DDR","PA","RCA","ABS","AA","DIY","LDPE","MMC","UFO","IPOD","MDF","CDR","MTB","DIVX","HDTV"];
	var prep = ["of","for","and","or","with","in","the"];
	var reg = new RegExp("")
	if(first_nmchk == "Y"){
		// first_nmchk = "N";
		keyValue = eval("document.catForm."+f_name+".value");
		if(keyValue.search(/[A-Z]/)!=-1 && keyValue.search(/[a-z]/)==-1 ) {
			modified1 = "Y";
			keyValue = keyValue.toLowerCase();
		}
		if(keyValue.search(/\b[a-z]+[A-Z]/)!=-1) {
			keyValue = keyValue.toLowerCase();
		}
		for(i=0;keyValue.length > i;i++){
			if(i ==0)
				str = keyValue.charAt(i).toUpperCase();
			else if(keyValue.charAt(i) == "{"
				||keyValue.charAt(i) == "}"
				||keyValue.charAt(i) == "("
				||keyValue.charAt(i) == ")"
				||keyValue.charAt(i) == "<"
				||keyValue.charAt(i) == ">"
				||keyValue.charAt(i) == " "
				||keyValue.charAt(i) == "."
				||keyValue.charAt(i) == ","
				||keyValue.charAt(i) == ":"
				||keyValue.charAt(i) == ";"
				||keyValue.charAt(i) == "!"
				||keyValue.charAt(i) == "&"
				||keyValue.charAt(i) == "/"){
				chk_value = "Y";
				str = str + keyValue.charAt(i);
			}else if(chk_value == "Y"){
				str = str + keyValue.charAt(i).toUpperCase();
				chk_value = "N"
			}else 
				str = str + keyValue.charAt(i);
		}
		for(i=0;abbr.length > i;i++){
			reg.compile("\\b"+abbr[i]+"\\b","gi");
			str = str.replace(reg, abbr[i]);
		}
		for(i=0;prep.length > i;i++){
			reg.compile(" "+prep[i]+"\\b","gi");
			str = str.replace(reg, " "+prep[i]);
		}
		reg.compile("\\b[a-zA-Z]+[0-9-]*[0-9]+\\b","gi");
		i=0;
		while((pos = str.substring(i,str.length).search(reg))!=-1){
			matchstr = str.substring(i,str.length).match(reg);
			if (pos > -1){
				pos = pos+i;
				str = str.substring(0,pos)+str.substring(pos,pos+matchstr[0].length).toUpperCase()+str.substring(pos+matchstr[0].length,str.length);
			}
			i = pos + matchstr[0].length;
		}
		con_nm = eval("document.catForm."+f_name);
		con_nm.value = str;
	}
}
/* CONVERT DATA INTO STANDARD CASE END*/

function checkForm(theForm)
{
	
	if(theForm.address.value.indexOf('href=') != -1 || theForm.address.value.indexOf('Href=') != -1)
	{
		alert("Do not allow to enter href= !!!");
		theForm.address.focus();
		return false;	
	}
	
	if(theForm.com_profile.value.indexOf('href=') != -1 || theForm.com_profile.value.indexOf('Href=') != -1)
	{
		alert("Do not allow to enter href= !!!");
		theForm.com_profile.focus();
		return false;	
	}	
	
	if(theForm.search_keys.value.indexOf('href=') != -1 || theForm.search_keys.value.indexOf('Href=') != -1)
	{
		alert("Do not allow to enter href= !!!");
		theForm.search_keys.focus();
		return false;	
	}
	
//compnay Name
	if(theForm.c_name.value.length == 0)
	{
		alert("Company Name Should Not Be Empty!!!");
		theForm.c_name.focus();
		return false;	
	}
	if(theForm.c_name.value.length < 6)
	{
		alert("Company Name Entered Atleast 6 Characters!!!");
		theForm.c_name.focus();
		return false;	
	}

//Address
	if(theForm.address.value.length == 0)
	{
		alert("Address Should Not Be Empty!!!");
		theForm.address.focus();
		return false;	
	}
	if(theForm.address.value.length>255)
	{
		alert("Address Entered upto 255 characters only!!!");
		theForm.address.focus();
		return false;	
	}
//City
	if(theForm.city.value.length == 0)
	{
		alert("City Should Not Be Empty!!!");
		theForm.city.focus();
		return false;	
	}

//Country
	if(theForm.country.value.length == 0)
	{
		alert("Country Should Not Be Select!!!");
		theForm.country.focus();
		return false;	
	}
// phone
	if(theForm.phone.value.length == 0)
	{
		alert("Phone Should Not Be Select!!!");
		theForm.phone.focus();
		return false;	
	}
	
//WEBSITE VALIDATION
//	var web=theForm.website.value;
//	var newweb=web.substring(0,4);
//	if(newweb=='http')
//	{
//		alert ("You Enter 'http' in website.\nPlease truncate 'http'!!!");
//		theForm.website.select();
//		return false;
//	}
	
	le=theForm.website.value.length;
	if(le>0)
	{
		if (theForm.website.value != 'http://') {
			
			var lastdot = theForm.website.value.lastIndexOf(".");
			if(lastdot>=(le-2) || lastdot<=3)
			{
				alert ("Please Enter Valid Website!!!");
				theForm.website.select();
				return false;
			} 
			
		}
			
 	}

	//E-Mail
	if(theForm.email1.value.length == 0)
	{
		alert("Email-1 Should Not Be Empty!!!");
		theForm.email1.focus();
		return false;	
	}

//now let's check if email is correct. This field name is "email1"
	if(notValidEmail(theForm.email1))
	{
		alert("Please Enter valid E-mail Address in Email-1 !!!");
		theForm.email1.select();
		theForm.email1.focus();
		return false;		  
	}

//now let's check if email is correct. This field name is "email2"
	if( notValidEmail( theForm.email2 ) && theForm.email2.value !='')
	{
		alert("Please Enter valid E-mail Address in Email-2 !!!");
		theForm.email2.focus();
		return false;
	}
	
	theForm.image_path.value = theForm.image_link.value;
/*
//COMPANY PROFILE
	if(theForm.com_profile.value.length == 0)
	{
		alert("Company Profile Should Not Be Blank!!!");
		theForm.com_profile.focus();
		return false;	
	}

	if(theForm.com_profile.value.length <20)
	{
		alert("In Company Profile Enter Atleast 20 Characters!!!");
		theForm.com_profile.focus();
		return false;	
	}*/
//Search Keys
	if(theForm.search_keys.value.length == 0)
	{
		alert("Products Should Not Be Empty!!!");
		theForm.search_keys.focus();
		return false;	
	}

	if(theForm.search_keys.value.length < 6)
	{
		alert("Products Entered Atleast 6 Characters!!!");
		theForm.search_keys.focus();
		return false;	
	}
	
	
	if(theForm.verification.value.length==0)
	{
		alert("Please enter verification code !!!");
		theForm.verification.focus();
		return false;
	}
	if(theForm.verification.value!=theForm.verification_code.value)
	{
		alert("Verification code does not match !!!");
		theForm.verification.focus();
		return false;
	}
	
	
	
	return true;
}
function notValidEmail( str )
{
	mailRE = new RegExp( );
	mailRE.compile( '^[\._a-z0-9-]+@[\.a-z0-9-]+[\.]{1}[a-z]{2,4}$', 'gi' );
	return !(mailRE.test( str.value ));
} 

/*CHECK EMAIL VALIDATION FUNCTION*/
function textLimitCheck(thisArea, maxLength, messageCount)
{
	if (thisArea.value.length > maxLength)
    {
        alert(maxLength + ' characters limit. \rExcessive data will be truncated.');
        thisArea.value = thisArea.value.substring(0, maxLength);
        thisArea.focus();
    }
	//messageCount.innerHTML = thisArea.value.length;
    document.getElementById(messageCount).innerHTML = thisArea.value.length;
}

/*CONVERT INTO LOWER CASE*/
function lower_web(f_name)
{
	keyValue = f_name;
	keyValue = keyValue.toLowerCase();
	document.catForm.website.value=keyValue;
}
function lower_email1(f_name)
{
	keyValue = f_name;
	keyValue = keyValue.toLowerCase();
	document.catForm.email1.value=keyValue;
}

function lower_email2(f_name)
{
	keyValue = f_name;
	keyValue = keyValue.toLowerCase();
	document.catForm.email2.value=keyValue;
}

var on_color = "#FF0000";
var off_color = "#1F48BB";
var blink_onoff = 1;
var blinkspeed= 500;
function blink()
{
	if( blink_onoff == 1) {
           document.all.blink.style.color = on_color;
	   blink_onoff = 0;
	}
	else {
	   document.all.blink.style.color = off_color;
	   blink_onoff = 1;
	}
}
function addToBasket()
{
	searchForm_detail.action=searchForm_detail.send_action.value;
	searchForm_detail.submit();
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function __ajaxObject( url, pArr, funName ) {
	
	xmlHttp = false;
	
	if( window.XMLHttpRequest ) 
		xmlHttp = new XMLHttpRequest( ) ;
	else if( window.ActiveXObject )
		xmlHttp = new ActiveXObject( "Microsoft.XMLHTTP" );
	
	if( xmlHttp ) {
		parameters = '';
		for( i = 0; i < pArr.length; i++ ) {
			if( parameters != '' ) {
				parameters += "&" + pArr[i][0] + "=" + encodeURI( pArr[i][1] );
			} else {
				parameters = pArr[i][0] + "=" + encodeURI( pArr[i][1] );
			}
		}
		
		xmlHttp.open( 'post', url, true );
		xmlHttp.setRequestHeader( "Content-type", "application/x-www-form-urlencoded" );
		xmlHttp.setRequestHeader( "Content-length", parameters.length );
		xmlHttp.setRequestHeader( "Connection", "close" );
		xmlHttp.send( parameters );
		xmlHttp.onreadystatechange = function( ) {
			if( xmlHttp.readyState == 4 ) {
				//xmlHttp.XML = xmlHttp.responseXML != null ? xmlHttp.responseXML : '';
				//xmlHttp.TEXT = xmlHttp.responseText != null ? xmlHttp.responseText : '';
				eval( funName );
			}
		};
		return xmlHttp;
	}
	
}


	function shiftTab(id){
		if(id == "company"){
			
			document.getElementById("t1").style.display = "none";
			document.getElementById("trade").style.backgroundImage  = "url(<?echo $baseurl?>/images/srch-but-bg1.gif)";
			document.getElementById("t3").style.display = "none";
			document.getElementById("trade").className = "link_black";
			
			document.getElementById("p1").style.display = "none";
			document.getElementById("products").style.backgroundImage  = "url(<?echo $baseurl?>/images/srch-but-bg1.gif)";
			document.getElementById("p3").style.display = "none";
			document.getElementById("products").className = "link_black";
			
			document.getElementById("l1").style.display = "inline";
			
			document.getElementById("c1").style.display = "inline";
			document.getElementById("c11").src = "<?echo $baseurl?>/images/srch-top-left.gif";
			document.getElementById("company").style.backgroundImage  = "url(<?echo $baseurl?>/images/srch-but-bg.gif)";
			document.getElementById("c3").style.display = "inline";
			document.getElementById("company").className = "link_white";
			
			document.getElementById("companyFrm").style.display = "inline";
			document.getElementById("productsFrm").style.display = "none";
			document.getElementById("tradeFrm").style.display = "none";
		} else if(id == "products"){
			
			//document.getElementById("c11").style.display = "none";
			document.getElementById("c11").src = "<?echo $baseurl?>/images/srch-top-left11.gif";
			document.getElementById("company").style.backgroundImage  = "url(<?echo $baseurl?>/images/srch-but-bg1.gif)";
			document.getElementById("c3").style.display = "none";
			document.getElementById("company").className  = "link_black";

			document.getElementById("t1").style.display = "none";
			document.getElementById("trade").style.backgroundImage  = "url(<?echo $baseurl?>/images/srch-but-bg1.gif)";
			document.getElementById("t3").style.display = "none";
			document.getElementById("trade").className = "link_black";
			
			document.getElementById("l1").style.display = "inline";
			
			document.getElementById("p1").style.display = "inline";
			document.getElementById("products").style.backgroundImage  = "url(<?echo $baseurl?>/images/srch-but-bg.gif)";
			document.getElementById("p3").style.display = "inline";
			document.getElementById("products").className = "link_white";
			
			document.getElementById("companyFrm").style.display = "none";
			document.getElementById("productsFrm").style.display = "inline";
			document.getElementById("tradeFrm").style.display = "none";
		} else if(id == "trade"){
			
			document.getElementById("c11").src = "<?echo $baseurl?>/images/srch-top-left11.gif";
			document.getElementById("company").style.backgroundImage  = "url(<?echo $baseurl?>/images/srch-but-bg1.gif)";
			document.getElementById("c3").style.display = "none";
			document.getElementById("company").className = "link_black";
			
			document.getElementById("p1").style.display = "none";
			document.getElementById("products").style.backgroundImage  = "url(<?echo $baseurl?>/images/srch-but-bg1.gif)";
			document.getElementById("p3").style.display = "none";
			document.getElementById("products").className = "link_black";
			
			document.getElementById("l1").style.display = "none";
			
			document.getElementById("t1").style.display = "inline";
			document.getElementById("trade").style.backgroundImage  = "url(<?echo $baseurl?>/images/srch-but-bg.gif)";
			document.getElementById("t3").style.display = "inline";
			document.getElementById("trade").className = "link_white";
			
			document.getElementById("companyFrm").style.display = "none";
			document.getElementById("productsFrm").style.display = "none";
			document.getElementById("tradeFrm").style.display = "inline";
		}
	}
	
	
	function shiftLatestTab(id){
		if(id == "ltcom"){
			document.getElementById("more").innerHTML = '<a href="new_listing.php">More</a>';
			document.getElementById("lcl").src = "images/trade-leads-lt.gif";
			document.getElementById("lcr").src = "images/trade-leads-rt.gif";
			document.getElementById("lol").src = "images/trade-leads-lt1.gif";
			document.getElementById("lor").src = "images/trade-leads-rt1.gif";
			document.getElementById("losl").src = "images/trade-leads-lt1.gif";
			document.getElementById("losr").src = "images/trade-leads-rt1.gif";
			document.getElementById("lobl").src = "images/trade-leads-lt1.gif";
			document.getElementById("lobr").src = "images/trade-leads-rt1.gif";
			
			document.getElementById("lc").style.backgroundImage = "url(images/trade-leads-bg.gif)";
			document.getElementById("los").style.backgroundImage = "url(images/trade-leads-bg1.gif)";
			document.getElementById("lob").style.backgroundImage = "url(images/trade-leads-bg1.gif)";
			document.getElementById("lo").style.backgroundImage = "url(images/trade-leads-bg1.gif)";
			
			document.getElementById("latestMsg").innerHTML = "&nbsp;&raquo; Latest updated Company Listing of Manufactures, Exporters & Importers.";
			document.getElementById("ltcom").style.display = "inline";
			document.getElementById("ltoffer").style.display = "none";
			document.getElementById("ltbuy").style.display = "none";
			document.getElementById("ltsale").style.display = "none";
			
		} else if(id == "ltoffer"){
			document.getElementById("more").innerHTML = '<a href="trade_alerts.php">More</a>';
			document.getElementById("lcl").src = "images/trade-leads-lt1.gif";
			document.getElementById("lcr").src = "images/trade-leads-rt1.gif";
			document.getElementById("lol").src = "images/trade-leads-lt.gif";
			document.getElementById("lor").src = "images/trade-leads-rt.gif";
			document.getElementById("losl").src = "images/trade-leads-lt1.gif";
			document.getElementById("losr").src = "images/trade-leads-rt1.gif";
			document.getElementById("lobl").src = "images/trade-leads-lt1.gif";
			document.getElementById("lobr").src = "images/trade-leads-rt1.gif";
			
			document.getElementById("lc").style.backgroundImage = "url(images/trade-leads-bg1.gif)";
			document.getElementById("los").style.backgroundImage = "url(images/trade-leads-bg1.gif)";
			document.getElementById("lob").style.backgroundImage = "url(images/trade-leads-bg1.gif)";
			document.getElementById("lo").style.backgroundImage = "url(images/trade-leads-bg.gif)";
			
			document.getElementById("latestMsg").innerHTML = "&nbsp;&raquo; Latest offer Listing of Buy, Sale, Services.";
			document.getElementById("ltcom").style.display = "none";
			document.getElementById("ltoffer").style.display = "inline";
			document.getElementById("ltbuy").style.display = "none";
			document.getElementById("ltsale").style.display = "none";
			
		} else if(id == "ltbuy"){
			
			document.getElementById("more").innerHTML = '<a href="offer_buy.php">More</a>';
			document.getElementById("lcl").src = "images/trade-leads-lt1.gif";
			document.getElementById("lcr").src = "images/trade-leads-rt1.gif";
			document.getElementById("lol").src = "images/trade-leads-lt1.gif";
			document.getElementById("lor").src = "images/trade-leads-rt1.gif";
			document.getElementById("losl").src = "images/trade-leads-lt1.gif";
			document.getElementById("losr").src = "images/trade-leads-rt1.gif";
			document.getElementById("lobl").src = "images/trade-leads-lt.gif";
			document.getElementById("lobr").src = "images/trade-leads-rt.gif";
			
			document.getElementById("lc").style.backgroundImage = "url(images/trade-leads-bg1.gif)";
			document.getElementById("los").style.backgroundImage = "url(images/trade-leads-bg1.gif)";
			document.getElementById("lob").style.backgroundImage = "url(images/trade-leads-bg.gif)";
			document.getElementById("lo").style.backgroundImage = "url(images/trade-leads-bg1.gif)";
			
			document.getElementById("latestMsg").innerHTML = "&nbsp;&raquo; Latest Buy offers.";
			document.getElementById("ltcom").style.display = "none";
			document.getElementById("ltoffer").style.display = "none";
			document.getElementById("ltbuy").style.display = "inline";
			document.getElementById("ltsale").style.display = "none";
		}else if(id == "ltsale"){
			
			document.getElementById("more").innerHTML = '<a href="offer_sale.php">More</a>';
			document.getElementById("lcl").src = "images/trade-leads-lt1.gif";
			document.getElementById("lcr").src = "images/trade-leads-rt1.gif";
			document.getElementById("lol").src = "images/trade-leads-lt1.gif";
			document.getElementById("lor").src = "images/trade-leads-rt1.gif";
			document.getElementById("losl").src = "images/trade-leads-lt.gif";
			document.getElementById("losr").src = "images/trade-leads-rt.gif";
			document.getElementById("lobl").src = "images/trade-leads-lt1.gif";
			document.getElementById("lobr").src = "images/trade-leads-rt1.gif";
			
			document.getElementById("lc").style.backgroundImage = "url(images/trade-leads-bg1.gif)";
			document.getElementById("los").style.backgroundImage = "url(images/trade-leads-bg.gif)";
			document.getElementById("lob").style.backgroundImage = "url(images/trade-leads-bg1.gif)";
			document.getElementById("lo").style.backgroundImage = "url(images/trade-leads-bg1.gif)";
			
			document.getElementById("latestMsg").innerHTML = "&nbsp;&raquo; Latest Sale offers.";
			document.getElementById("ltcom").style.display = "none";
			document.getElementById("ltoffer").style.display = "none";
			document.getElementById("ltbuy").style.display = "none";
			document.getElementById("ltsale").style.display = "inline";
		}
	}
	
	
	
	
	
	function checkSearch(frm){
		if(frm.keywords.value != ''){
			if(frm.keywords.value.length < 3){
				alert("Please enter at least three charecter");
				frm.keywords.focus();
				return false;
			}
		}
		return true;
	}
	
	function resetForm(frm){
	
	frm.keywords.value = '';
	frm.country.value = '';
	
	if(frm.offer_type!=null)
		frm.offer_type.value = '';
	
	if(frm.business_type!=null)
		frm.business_type.value = '';
		
	 frm.search_method[0].checked = "checked";
	
	}
	


function getCountryCombo(){
	
	return document.write("<select name='country' class='txtbox1'  id='country' style='width: 250px'><option value=''>--Select--</option><option value='4' >Afghanistan</option><option value='7' >Albania</option><option value='58' >Algeria</option><option value='13' >American Samoa</option><option value='2' >Andorra</option><option value='10' >Angola</option><option value='6' >Anguilla</option><option value='11' >Antarctica</option><option value='5' >Antigua And Barbuda</option><option value='12' >Argentina</option><option value='8' >Armenia</option><option value='16' >Aruba</option><option value='1' >Ascension Island</option><option value='15' >Australia</option><option value='14' >Austria</option><option value='17' >Azerbaijan</option><option value='31' >Bahamas</option><option value='24' >Bahrain</option><option value='20' >Bangladesh</option><option value='19' >Barbados</option><option value='35' >Belarus</option><option value='21' >Belgium</option><option value='36' >Belize</option><option value='26' >Benin</option><option value='27' >Bermuda</option><option value='32' >Bhutan</option><option value='29' >Bolivia</option><option value='18' >Bosnia And Herzegovina</option><option value='34' >Botswana</option><option value='33' >Bouvet Island</option><option value='30' >Brazil</option><option value='101' >British Indian Ocean Ter</option><option value='28' >Brunei Darussalam</option><option value='23' >Bulgaria</option><option value='22' >Burkina Faso</option><option value='25' >Burundi</option><option value='112' >Cambodia</option><option value='44' >Cameroon</option><option value='37' >Canada</option><option value='49' >Cap Verde</option><option value='118' >Cayman Islands</option><option value='40' >Central African Republic</option><option value='203' >Chad</option><option value='43' >Chile</option><option value='45' >China</option><option value='50' >Christmas Island</option><option value='38' >Cocos (keeling) Islands</option><option value='46' >Colombia</option><option value='114' >Comoros</option><option value='39' >Congo, Democratic Republic Of The</option><option value='42' >Cook Islands</option><option value='47' >Costa Rica</option><option value='93' >Croatia/hrvatska</option><option value='48' >Cuba</option><option value='51' >Cyprus</option><option value='52' >Czech Republic</option><option value='55' >Denmark</option><option value='54' >Djibouti</option><option value='56' >Dominica</option><option value='57' >Dominican Republic</option><option value='212' >East Timor</option><option value='59' >Ecuador</option><option value='61' >Egypt</option><option value='199' >El Salvador</option><option value='83' >Equatorial Guinea</option><option value='63' >Eritrea</option><option value='60' >Estonia</option><option value='65' >Ethiopia</option><option value='68' >Falkland Islands (malvina)</option><option value='70' >Faroe Islands</option><option value='67' >Fiji</option><option value='66' >Finland</option><option value='71' >France</option><option value='75' >French Guiana</option><option value='166' >French Polynesia</option><option value='204' >French Southern Territories</option><option value='72' >Gabon</option><option value='80' >Gambia</option><option value='74' >Georgia</option><option value='53' >Germany</option><option value='77' >Ghana</option><option value='78' >Gibraltar</option><option value='84' >Greece</option><option value='79' >Greenland</option><option value='73' >Grenada</option><option value='82' >Guadeloupe</option><option value='87' >Guam</option><option value='86' >Guatemala</option><option value='76' >Guernsey</option><option value='81' >Guinea</option><option value='88' >Guinea-bissau</option><option value='89' >Guyana</option><option value='94' >Haiti</option><option value='91' >Heard And Mcdonald Islands</option><option value='225' >Holy See (city Vatican State)</option><option value='92' >Honduras</option><option value='90' >Hong Kong</option><option value='95' >Hungary</option><option value='104' >Iceland</option><option value='100' >India</option><option value='96' >Indonesia</option><option value='103' >Iran (islamic Republic Of)</option><option value='102' >Iraq</option><option value='97' >Ireland</option><option value='99' >Isle Of Man</option><option value='98' >Israel</option><option value='105' >Italy</option><option value='107' >Jamaica</option><option value='109' >Japan</option><option value='106' >Jersey</option><option value='108' >Jordan</option><option value='119' >Kazakhstan</option><option value='110' >Kenya</option><option value='113' >Kiribati</option><option value='117' >Kuwait</option><option value='111' >Kyrgyzstan</option><option value='128' >Latvia</option><option value='120' >Lebanon</option><option value='125' >Lesotho</option><option value='124' >Liberia</option><option value='129' >Libya</option><option value='122' >Liechtenstein</option><option value='126' >Lithuania</option><option value='127' >Luxembourg</option><option value='139' >Macau</option><option value='135' >Macedonia, Former Yugoslav Republic</option><option value='133' >Madagascar</option><option value='147' >Malawi</option><option value='149' >Malaysia</option><option value='146' >Maldives</option><option value='136' >Mali</option><option value='144' >Malta</option><option value='134' >Marshall Islands</option><option value='141' >Martinique</option><option value='142' >Mauritania</option><option value='145' >Mauritius</option><option value='235' >Mayotte</option><option value='148' >Mexico</option><option value='69' >Micronesia, Federal State Of</option><option value='132' >Moldova, Republic Of</option><option value='131' >Monaco</option><option value='138' >Mongolia</option><option value='143' >Montserrat</option><option value='130' >Morocco</option><option value='150' >Mozambique</option><option value='137' >Myanmar</option><option value='151' >Namibia</option><option value='160' >Nauru</option><option value='159' >Nepal</option><option value='157' >Netherlands</option><option value='9' >Netherlands Antilles</option><option value='152' >New Caledonia</option><option value='162' >New Zealand</option><option value='156' >Nicaragua</option><option value='153' >Niger</option><option value='155' >Nigeria</option><option value='161' >Niue</option><option value='154' >Norfolk Island</option><option value='116' >North Korea</option><option value='140' >Northern Mariana Islands</option><option value='158' >Norway</option><option value='163' >Oman</option><option value='169' >Pakistan</option><option value='176' >Palau</option><option value='174' >Palestinian Territories</option><option value='164' >Panama</option><option value='167' >Papua New Guinea</option><option value='177' >Paraguay</option><option value='165' >Peru</option><option value='168' >Philippines</option><option value='172' >Pitcairn Island</option><option value='170' >Poland</option><option value='175' >Portugal</option><option value='173' >Puerto Rico</option><option value='178' >Qatar</option><option value='179' >Reunion Island</option><option value='180' >Romania</option><option value='181' >Russian Federation</option><option value='182' >Rwanda</option><option value='115' >Saint Kitts And Nevis</option><option value='121' >Saint Lucia</option><option value='226' >Saint Vincent And The Grenadines</option><option value='194' >San Marino</option><option value='198' >Sao Tome And Principe</option><option value='183' >Saudi Arabia</option><option value='195' >Senegal</option><option value='185' >Seychelles</option><option value='193' >Sierra Leone</option><option value='188' >Singapore</option><option value='192' >Slovak Republic</option><option value='190' >Slovenia</option><option value='184' >Solomon Islands</option><option value='196' >Somalia</option><option value='237' >South Africa</option><option value='85' >South Georgia</option><option value='240' >South Korea</option><option value='64' >Spain</option><option value='123' >Sri Lanka</option><option value='189' >St Helena</option><option value='171' >St Pierre And Miquelon</option><option value='186' >Sudan</option><option value='197' >Suriname</option><option value='191' >Svalbard And Jan Mayen Islands</option><option value='201' >Swaziland</option><option value='187' >Sweden</option><option value='41' >Switzerland</option><option value='200' >Syrian Arab Republic</option><option value='216' >Taiwan</option><option value='207' >Tajikistan</option><option value='217' >Tanzania</option><option value='206' >Thailand</option><option value='205' >Togo</option><option value='208' >Tokelau</option><option value='211' >Tonga</option><option value='214' >Trinidad And Tobago</option><option value='210' >Tunisia</option><option value='213' >Turkey</option><option value='209' >Turkmenistan</option><option value='202' >Turks And Caicos Islands</option><option value='215' >Tuvalu</option><option value='219' >Uganda</option><option value='218' >Ukraine</option><option value='3' >United Arab Emirates</option><option value='220' >United Kingdom</option><option value='222' >United States</option><option value='223' >Uruguay</option><option value='221' >Us Minor Outlying Islands</option><option value='224' >Uzbekistan</option><option value='231' >Vanuatu</option><option value='227' >Venezuela</option><option value='230' >Vietnam</option><option value='228' >Virgin Islands (British)</option><option value='229' >Virgin Islands (USA)</option><option value='232' >Wallis And Futuna Islands</option><option value='62' >Western Sahara</option><option value='233' >Western Samoa</option><option value='234' >Yemen</option><option value='236' >Yugoslavia</option><option value='238' >Zambia</option><option value='239' >Zimbabwe</option></select>");	
}



