function check_advanced_search(flag)
{
	var str='';

	if(flag == 1)
	{
		form1 = document.quick_find;
	}
	else
	{
		form1 = document.quick_find1;
	}

        form1.ss.value = form1.ss.value.replace(/^\s+/g, '').replace(/\s+$/g, '');
	while(form1.ss.value.indexOf('  ')>0)
	{
		form1.ss.value = form1.ss.value.replace('  ',' ');	
	}
	form1.ss.value = form1.ss.value.replace(/[^a-zA-Z0-9+ ]/g, ' ');
	
	var temp=form1.ss.value.replace(/\s/g, '');
        if (form1.ss.value.length < 3)
        {
                alert("Enter at least three characters for search.");
                form1.ss.focus();
                return false;
        }
        else
        {
		var a = form1.ss.value.replace(/\+/g, ' ');
		a = a.replace(/\s+/g, '+');
		str +='ss='+a;
		str = "http://www.hellotrade.com/suppliers?"+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;
}


/*
function check_advanced_search(kw)  {
  error = 0;
  if (kw.length < 3) {
    error_message = "Please enter atleast 3 characters for search";
    error = 1;
  }
  if (kw == "Enter Product / Company Name")
  {
 	error_message = "Please enter correct string for search";
    	error = 2;
  }
  

  if (error == 1) {
    alert(error_message);
//     document.quick_find.ss.focus();
    return false;
  } 
  if (error == 2) {
    alert(error_message);
//     document.quick_find.ss.focus();
    return false;
  } 
  else {
    return true;
  }
} 
function check_advanced_search_footer(kw)  {
  error = 0;
  if (kw.length < 3) {
    error_message = "Please enter atleast 3 characters for search";
    error = 1;
  }
  if (kw == "Enter Product / Company Name")
  {
 	error_message = "Please enter correct string for search";
    	error = 2;
  }
  

  if (error == 1) {
    alert(error_message);
//     document.quick_find_footer.ss.focus();
    return false;
  } 
  if (error == 2) {
    alert(error_message);
//     document.quick_find_footer.ss.focus();
    return false;
  } 
  else {
    return true;
  }
}*/ 

function searchsubmit(a)
{
	document.quick_find1.pg.value=a;
	document.quick_find1.submit();
	return true;
}

function doPostBack() {
		var theform;
		if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
			theform = document.frmSearch;
		}
		else {
			theform = document.forms["frmSearch"];
		}
		theform.submit();
		return true;
	}
function check_query_submit(frmname)
{
	frmname.submit();
	return true;
}

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;
function openchild(thisurl){
	if ( CanAnimate ){
			msgWindow=window.open( '' ,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=635,height=230,left=0,top=0');
			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=635,height=360,left=0,top=0');
	}
}
function unhide(divID) {

  var item = document.getElementById(divID);
  if (item) {
    item.className=(item.className=='hidden')?'unhidden':'hidden';
  }
  hide('sub2');
}
function hide(divID) {
  var item = document.getElementById(divID);
  if (item) {
    item.className=(item.className=='unhidden')?'hidden':'unhidden';
  }
}
function unhide1(divID) {
  var item = document.getElementById(divID);
  if (item) {
    item.className=(item.className=='hidden1')?'unhidden1':'hidden1';
  }
  hide1('sub4');
}
function hide1(divID) {
  var item = document.getElementById(divID);
  if (item) {
    item.className=(item.className=='unhidden1')?'hidden1':'unhidden1';
  }
}
function unhide2(divID) {

  var item = document.getElementById(divID);
  if (item) {
    item.className=(item.className=='hidden')?'unhidden':'hidden';
  }
  hide2('sub20');
}
function hide2(divID) {
  var item = document.getElementById(divID);
  if (item) {
    item.className=(item.className=='unhidden')?'hidden':'unhidden';
  }
}
expires = new Date();
expires.setTime (expires.getTime() + 24 * 60 * 60 * 150 * 1000);

function set()
{
	if(document.dataform.Description.value == "") {
		alert ("Kindly describe your requirement.");
		document.dataform.Description.focus();
		return false;
	}
	if (document.dataform.Description.value.length>2000) {
		alert("Kindly describe your requirement within the limit of 2000 characters.");
		document.dataform.Description.focus();
		return false;
	}
	
	if (document.dataform.S_first_name.value.length == "")  {
		alert ("Kindly enter your first name.");
		document.dataform.S_first_name.focus();
		return false;
	}
	else if(document.dataform.S_first_name.value == "First Name")
	{
		alert("Kindly enter your first name.")	
		document.dataform.S_first_name.focus();
		return false;
	}

	if (document.dataform.S_last_name.value == 'Last Name') 
	{
		document.dataform.S_last_name.value = '';
	}


	if(document.dataform.S_email.value == "" ) {
			alert("Kindly enter your E-mail id.");
			document.dataform.S_email.focus();
			return false;
	}
	if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.dataform.S_email.value))) {
			alert("Invalid E-mail id. kindly enter the correct id.");
			document.dataform.S_email.focus();
			return (false);
	}
	if (document.dataform.S_country.selectedIndex == 0)  {
		alert ("Kindly select your country name.");
		document.dataform.S_country.focus();
		return false;
	}
	if (document.dataform.S_ccode.value.length == 0)  {
		alert ("Kindly enter your country code.");
		document.dataform.S_ccode.focus();
		return false;
	}
	
	if (((document.dataform.S_phone.value =='') || (document.dataform.S_phone.value.length == 0 )) && ((document.dataform.S_mobile.value == '') || (document.dataform.S_mobile.value.length == 0)))
	{
		alert ("Kindly enter either phone number or mobile number.");
		document.dataform.S_phone.focus();
		return false;
	}

	if(document.dataform.captcha_text.value == '')
	{
		alert("Kindly enter the code as appearing in the image.");
		document.dataform.captcha_text.focus();
		return false;
	}

	
	newIILCookie =document.dataform.S_first_name.value;
	newIILCookie +="|"+document.dataform.S_last_name.value;
	newIILCookie +="|"+document.dataform.S_email.value;
	newIILCookie +="|"+document.dataform.S_country.selectedIndex;
	newIILCookie +="|"+document.dataform.S_ccode.value;
	newIILCookie +="|"+document.dataform.S_acode.value;
	newIILCookie +="|"+document.dataform.S_phone.value;
	newIILCookie +="|"+document.dataform.S_mcode.value;
	newIILCookie +="|"+document.dataform.S_mobile.value;
	newIILCookie +="|"+document.dataform.S_countryname.value;
	newIILCookie +="|";
	


	var name=parent.document.dataform.fname.value;
    document.dataform1.S_first_name.value=name;
	document.callme.S_first_name.value=name;
	

	var lastname=parent.document.dataform.lname.value;
    document.dataform1.S_last_name.value=lastname;
	document.callme.S_last_name.value=lastname;

	var email=parent.document.dataform.S_email.value;
    document.dataform1.S_email.value=email;
	document.callme.S_email.value=email;

	var country=parent.document.dataform.S_country.value;
    document.dataform1.S_country.value=country;
	document.callme.S_country.value=country;

	var countrycode=parent.document.dataform.S_ccode.value;
    document.dataform1.S_ccode.value=countrycode;
	document.callme.S_ccode.value=countrycode;

	var phone=parent.document.dataform.S_phone.value;
    document.dataform.S_phone.value=phone;
	document.callme.S_phone.value=phone;
	
	setCookie("newImeshIDvisitor",newIILCookie);
	if( (desccookie = getCookie("NewDescCookievisitor")) > "") 
	{
		document.cookie = "NewDescCookievisitor" + "=" + "" + ";" + "path=/;" ;
	}
} 





function set1(){
	if(document.dataform1.Description.value == "") {
		alert ("Kindly describe your requirement.");
		document.dataform1.Description.focus();
		return false;
	}
	if (document.dataform1.Description.value.length>2000) {
		alert("Kindly describe your requirement within the limit of 2000 characters.");
		document.dataform1.Description.focus();
		return false;
	}
	
	if (document.dataform1.S_first_name.value.length == "")  {
		alert ("Kindly enter your first name.");
		document.dataform1.S_first_name.focus();
		return false;
	}
	else if(document.dataform1.S_first_name.value == "First Name")
	{
		alert("Kindly enter your first name.")	
		document.dataform1.S_first_name.focus();
		return false;
	}


	if (document.dataform.S_last_name.value == 'Last Name') 
	{
		document.dataform.S_last_name.value = '';
	}


	if(document.dataform1.S_email.value == "" ) {
			alert("Kindly enter your E-mail id.");
			document.dataform1.S_email.focus();
			return false;
	}
	if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.dataform1.S_email.value))) {
			alert("Invalid E-mail id. kindly enter the correct id.");
			document.dataform1.S_email.focus();
			return (false);
	}
	
	if(document.dataform1.S_country[document.dataform1.S_country.selectedIndex].value == '')
	{
		alert("Kindly select your country name.");
		document.dataform1.S_country.focus();
		return false;
	}


	if (document.dataform1.S_ccode.value.length == 0)  {
		alert ("Kindly enter your country code.");
		document.dataform1.S_ccode.focus();
		return false;
	}
	
	if (((document.dataform1.S_phone.value =='') || (document.dataform1.S_phone.value.length == 0 )) && ((document.dataform1.S_mobile.value == '') || (document.dataform1.S_mobile.value.length == 0)))
	{
		alert ("Kindly enter either phone number or mobile number.");
		document.dataform1.S_phone.focus();
		return false;
	}


	if(document.dataform1.captcha_text.value == '')
	{
		alert("Kindly enter the code as appearing in the image.");
		document.dataform1.captcha_text.focus();
		return false;
	}
		
	newIILCookie =document.dataform1.S_first_name.value;
	newIILCookie +="|"+document.dataform1.S_last_name.value;
	newIILCookie +="|"+document.dataform1.S_email.value;
	newIILCookie +="|"+document.dataform1.S_country.selectedIndex;
	newIILCookie +="|"+document.dataform1.S_ccode.value;
	newIILCookie +="|"+document.dataform1.S_acode.value;
	newIILCookie +="|"+document.dataform1.S_phone.value;
	newIILCookie +="|"+document.dataform1.S_mcode.value;
	newIILCookie +="|"+document.dataform1.S_mobile.value;
	newIILCookie +="|";


	var name=parent.document.dataform1.fname.value;
    document.dataform.S_first_name.value=name;
	document.callme.S_first_name.value=name;

	var lastname=parent.document.dataform1.lname.value;
    document.dataform.S_last_name.value=lastname;
	document.callme.S_last_name.value=lastname;

	var email=parent.document.dataform1.S_email.value;
    document.dataform.S_email.value=email;
	document.callme.S_email.value=email;

	var country=parent.document.dataform1.S_country.value;
    document.dataform.S_country.value=country;
	document.callme.S_country.value=country;

	var countrycode=parent.document.dataform1.S_ccode.value;
    document.dataform.S_ccode.value=countrycode;
	document.callme.S_ccode.value=countrycode;

	var phone=parent.document.dataform1.S_phone.value;
    document.dataform.S_phone.value=phone;
	document.callme.S_phone.value=phone;
	
	setCookie("newImeshIDvisitor",newIILCookie);
	if( (desccookie = getCookie("NewDescCookievisitor")) > "") 
	{
		document.cookie = "NewDescCookievisitor" + "=" + "" + ";" + "path=/;" ;
	}
}




function setCookie(name, value) 
{
	if (value.length > 0) 
	{
		document.cookie = name + "=" + escape(value)+ ";"+"expires=" + expires.toGMTString() + ";" + "path=/;" ;
        }
}

function getCookie(Name) 
{
	var search = Name + "="
	if (document.cookie.length > 0) 
	{
		offset = document.cookie.indexOf(search)
		if (offset != -1) 
		{
			offset += search.length
			end = document.cookie.indexOf(";", offset)
			if (end == -1) end = document.cookie.length
			return unescape(document.cookie.substring(offset, end))
		}
	}
	return "";
}
	
var persistmenu="yes" 
var persisttype="sitewide" 

if (document.getElementById){
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('.submenu1{display: block;}\n')
document.write('</style>\n')
}
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";
		}
	}
}


function tabone1()
{
document.getElementById("tabone1").style.display="block";
document.getElementById("tabone2").style.display="none";
document.getElementById("tabone3").style.display="none";
}


function tabone2()
{
document.getElementById("tabone1").style.display="none";
document.getElementById("tabone2").style.display="block";
document.getElementById("tabone3").style.display="none";
}

function tabone3()
{
document.getElementById("tabone1").style.display="none";
document.getElementById("tabone2").style.display="none";
document.getElementById("tabone3").style.display="block";
}



function tabtwo1()
{
document.getElementById("tabtwo1").style.display="block";
document.getElementById("tabtwo2").style.display="none";
document.getElementById("tabtwo3").style.display="none";
}


function tabtwo2()
{
document.getElementById("tabtwo1").style.display="none";
document.getElementById("tabtwo2").style.display="block";
document.getElementById("tabtwo3").style.display="none";
}

function tabtwo3()
{
document.getElementById("tabtwo1").style.display="none";
document.getElementById("tabtwo2").style.display="none";
document.getElementById("tabtwo3").style.display="block";
}


function tabthree1()
{
document.getElementById("tabthree1").style.display="block";
document.getElementById("tabthree2").style.display="none";
document.getElementById("tabthree3").style.display="none";
}


function tabthree2()
{
document.getElementById("tabthree1").style.display="none";
document.getElementById("tabthree2").style.display="block";
document.getElementById("tabthree3").style.display="none";
}

function tabthree3()
{
document.getElementById("tabthree1").style.display="none";
document.getElementById("tabthree2").style.display="none";
document.getElementById("tabthree3").style.display="block";
}





function gallery(id,totalcount) 
{
	for(var i= 1; i <= totalcount; i++)
	{
		
		if(i == id)
		{
			document.getElementById('psc'+i).style.display = "block";
			document.getElementById('T'+i).className='selected';
		}
		else
		{
			document.getElementById('psc'+i).style.display = "none";
			document.getElementById('T'+i).className="";
		}
	}
}

