
<!--

lstFieldDisplay = new Array ("---Choose One---",
"Afghanistan",
"Albania",
"Algeria",
"American Samoa",
"Andorra",
"Angola",
"Anguilla",
"Antarctica",
"Antigua And Barbuda",
"Argentina",
"Armenia",
"Aruba",
"Australia",
"Austria",
"Azerbaijan",
"Bahamas, The",
"Bahrain",
"Bangladesh",
"Barbados",
"Belarus",
"Belgium",
"Belize",
"Benin",
"Bermuda",
"Bhutan",
"Bolivia",
"Bosnia And Herzegovina",
"Botswana",
"Bouvet Island",
"Brazil",
"British Indian Ocean Territory",
"Brunei",
"Bulgaria",
"Burkina Faso",
"Burundi",
"Cambodia",
"Cameroon",
"Canada",
"Cape Verde",
"Cayman Islands",
"Central African Republic",
"Chad",
"Chile",
"China",
"China (Hong Kong S.A.R.)",
"China (Macau S.A.R.)",
"Christmas",
"Cocos (Keeling) Islands",
"Colombia",
"Comoros",
"Congo",
"Congo, Democractic Republic Of",
"Cook Islands",
"Costa Rica",
"Cote D Ivoire (Ivory Coast)",
"Croatia (Hrvatska)",
"Cuba",
"Cyprus",
"Czech Republic",
"Denmark",
"Djibouti",
"Dominica",
"Dominican Republic",
"East Timor",
"Ecuador",
"Egypt",
"El Salvador",
"Equatorial Guinea",
"Eritrea",
"Estonia",
"Ethiopia",
"Faeroe Islands",
"Falkland Islands (Islas Malvin",
"Fiji Islands",
"Finland",
"France",
"French Guiana",
"French Polynesia",
"French Southern Territories",
"Gabon",
"Gambia, The",
"Georgia",
"Germany",
"Ghana",
"Gibraltar",
"Greece",
"Greenland",
"Grenada",
"Guadeloupe",
"Guam",
"Guatemala",
"Guinea",
"Guinea-Bissau",
"Guyana",
"Haiti",
"Heard And Mcdonald Islands",
"Holy See",
"Honduras",
"Hungary",
"Iceland",
"India",
"Indonesia",
"Iran",
"Iraq",
"Ireland",
"Israel",
"Italy",
"Jamaica",
"Japan",
"Jordan",
"Kazakhstan",
"Kenya",
"Kiribati",
"Korea",
"Korea, North",
"Kuwait",
"Kyrgyzstan",
"Lao People'S Democratic Republic",
"Latvia",
"Lebanon",
"Lesotho",
"Liberia",
"Libya",
"Liechtenstein",
"Lithuania",
"Luxembourg",
"Macedonia",
"Madagascar",
"Malawi",
"Malaysia",
"Maldives",
"Mali",
"Malta",
"Marshall Islands",
"Martinique",
"Mauritania",
"Mauritius",
"Mayotte",
"Mexico",
"Micronesia",
"Moldova",
"Monaco",
"Mongolia",
"Montserrat",
"Morocco",
"Mozambique",
"Myanmar",
"Namibia",
"Nauru",
"Nepal",
"Netherlands Antilles",
"New Caledonia",
"New Zealand",
"Nicaragua",
"Niger",
"Nigeria",
"Niue",
"Norfolk Island",
"Northern Mariana Islands",
"Norway",
"Oman",
"Pakistan",
"Palau",
"Panama",
"Papua New Guinea",
"Paraguay",
"Peru",
"Philippines",
"Pitcairn Island",
"Poland",
"Portugal",
"Puerto Rico",
"Qatar",
"Reunion",
"Romania",
"Russia",
"Rwanda",
"Saint Helena",
"Saint Kitts And Nevis",
"Saint Lucia",
"Saint Pierre And Miquelon",
"Saint Vincent And The Grenadin",
"Samoa",
"San Marino",
"Sao Tome And Principe",
"Saudi Arabia",
"Senegal",
"Serbia And Montenegro",
"Seychelles",
"Sierra Leone",
"Singapore",
"Slovakia",
"Slovenia",
"Solomon Islands",
"Somalia",
"South Africa",
"South Georgia",
"Spain",
"Sri Lanka",
"Sudan",
"Suriname",
"Svalbard And Jan Mayen Islands",
"Swaziland",
"Sweden",
"Switzerland",
"Syria",
"Taiwan",
"Tajikistan",
"Tanzania",
"Thailand",
"The Netherlands",
"Togo",
"Tokelau",
"Tonga",
"Trinidad And Tobago",
"Tunisia",
"Turkey",
"Turkmenistan",
"Turks And Caicos Islands",
"Tuvalu",
"Uganda",
"Ukraine",
"United Arab Emirates",
"United Kingdom",
"United States Minor Outlying I",
"United States Of America",
"Uruguay",
"Uzbekistan",
"Vanuatu",
"Venezuela",
"Vietnam",
"Virgin Islands (British)",
"Virgin Islands (Us)",
"Wallis And Futuna Islands",
"Western Sahara",
"Yemen",
"Zambia",
"Zimbabwe"
);

function form_drop_down( strControl, strPreviousValue, lstValues, lstDisplay ) {

	document.write( '<select name="');
	document.write( strControl );
	document.writeln(	'">');
	iFldCnt = lstValues.length;
	iFld = 0;
	if (strPreviousValue == "")
	{
		strPreviousValue = lstValues[0];
	}

	while( iFld < iFldCnt )
	{
		document.write( '<option value="');
		document.write( lstValues[ iFld ] );
		document.write( '" ');
		if( strPreviousValue == lstValues[ iFld ] )
		{
			document.write( 'selected' );
		}
		document.writeln( '>');
		document.write( lstDisplay[ iFld ] );
		document.write( '</option>');
		iFld ++;
	}
	document.write( '</select>');
}
// -->

function createRequestObject(){
	var request_o;
	var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer"){
		request_o = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		request_o = new XMLHttpRequest();
	}
	return request_o;
}

var http = createRequestObject();

function getcat(catid,host){
	var id=catid.split("_");
	http.open('get', 'http://'+host+'/search_cat.php?action=getcat&catid='+id[0]);
	http.onreadystatechange = handleAds;
	http.send(null);
}

function handleAds(){
	/* Make sure that the transaction has finished. The XMLHttpRequest object
		has a property called readyState with several states:
		0: Uninitialized
		1: Loading
		2: Loaded
		3: Interactive
		4: Finished */
	if(http.readyState == 4){ //Finished loading the response
		var response = http.responseText;
		/* And now we want to change the id1 <div> content.
			we do this using an ability to get/change the content of a page element
			that we can find: innerHTML. */
		document.getElementById('id1').innerHTML = response;
	}
}

function getProduct(host)
{
	var index1=document.dataform.selectcat.selectedIndex;
	var url1=document.dataform.selectcat.options[index1].value;
	var id=url1.split("_");
	var index=document.dataform.subcat.selectedIndex;
	var url=document.dataform.subcat.options[index].value;
	if(url != '/')
	{
		window.location.href='http://'+host+'/'+url+'/';
	}
	else if(id[1] != '/')
	{
		window.location.href='http://'+host+'/'+id[1]+'/';
	}
	else
	{
		window.location.href='http://'+host+'/';
	}
	return false;
}
expires = new Date();
expires.setTime (expires.getTime() + 24 * 60 * 60 * 150 * 1000);

function client_query_frm()
{
	if(document.dbfrm.Description.value == '')
	{
		alert("Please Enter Your Requirements");
		document.dbfrm.Description.focus();
		return (false);
	}

	if(document.dbfrm.quantity.value == '')
	{
		alert("Please Enter The Required Quantity");
		document.dbfrm.quantity.focus();
		return (false);
	}

	if(document.dbfrm.S_organization.value == '')
	{
		alert("Please Enter Your Organization/ Company");
		document.dbfrm.S_organization.focus();
		return (false);
	}

	if(document.dbfrm.S_name.value == '')
	{
		alert("Please Enter Contact Person Name");
		document.dbfrm.S_name.focus();
		return (false);
	}

	if(document.dbfrm.S_email.value == '')
	{
		alert("Please Enter The Email ID");
		document.dbfrm.S_email.focus();
		return (false);
	}

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

	if(document.dbfrm.S_phone_country_code.value == '' && document.dbfrm.S_phone.value != '')
	{
		alert("Please Enter Phone No with Country code");
		document.dbfrm.S_phone_country_code.focus();
		return (false);
	}

	if(document.dbfrm.S_phone.value == '')
	{
		alert("Please Enter Phone No");
		document.dbfrm.S_phone.focus();
		return (false);
	}

	if (document.dbfrm.S_country.selectedIndex == 0)
	{
		alert("Kindly Select Country.");
		document.dbfrm.S_country.focus();
		return (false);
	}

	newCookie = document.dbfrm.S_name.value;
	newCookie +="|"+document.dbfrm.S_email.value;
	newCookie +="|"+document.dbfrm.S_phone.value;
	newCookie +="|"+document.dbfrm.S_fax.value;
	newCookie +="|"+document.dbfrm.S_streetaddress.value;
	newCookie +="|"+document.dbfrm.S_city.value;
	newCookie +="|"+document.dbfrm.S_pin.value;
	newCookie +="|"+document.dbfrm.S_country.options[document.dbfrm.S_country.selectedIndex].value;
	newCookie +="|"+document.dbfrm.S_organization.value;
	newCookie +="|"+document.dbfrm.S_phone_country_code.value;
	newCookie +="|"+document.dbfrm.S_phone_area_code.value;
	newCookie +="|"+document.dbfrm.S_fax_country_code.value;
	newCookie +="|"+document.dbfrm.S_fax_area_code.value;
	setCookie("newImeshID",newCookie);
	//setCookie("newImeshID1",newCookie1);	//set cookies for new fields
	return (true);
}


function get()
{
	if((cookie = getCookie("newImeshID")) > "")
	{
		Values = cookie.split("|");
		if (Values.length >= 13)
		{
			if (document.dbfrm.S_name.value.length == 0)
				document.dbfrm.S_name.value = Values[0];
			if (document.dbfrm.S_email.value.length == 0)
				document.dbfrm.S_email.value = Values[1];
			if (document.dbfrm.S_phone.value.length == 0)
				document.dbfrm.S_phone.value=Values[2];
			if (document.dbfrm.S_fax.value.length == 0)
				document.dbfrm.S_fax.value=Values[3];
			if (document.dbfrm.S_streetaddress.value.length ==0)
				document.dbfrm.S_streetaddress.value=Values[4];
			if (document.dbfrm.S_city.value.length == 0)
				document.dbfrm.S_city.value=Values[5];
			if (document.dbfrm.S_pin.value.length == 0)
				document.dbfrm.S_pin.value=Values[6];
			//if (document.dbfrm.S_country.value.length == 0)
				//document.dbfrm.S_country.value=Values[7];
			for (i=0;i<iFldCnt;i++)
			{
				if(document.dbfrm.S_country.options[i].value.toUpperCase() == Values[7].toUpperCase())
				{
					break;
				}
			}

			if (i == iFldCnt)
			{
				if (document.dbfrm.S_country.selectedIndex == 0)
					document.dbfrm.S_country.selectedIndex=0;
			}
			else
			{
				if (document.dbfrm.S_country.selectedIndex == 0)
					document.dbfrm.S_country.selectedIndex=i;
			}
			if (document.dbfrm.S_organization.value.length == 0)
				document.dbfrm.S_organization.value=Values[8];

			if (document.dbfrm.S_phone_country_code.value.length == 0)
				document.dbfrm.S_phone_country_code.value = Values[9];
			if (document.dbfrm.S_phone_area_code.value.length == 0)
				document.dbfrm.S_phone_area_code.value = Values[10];
			if (document.dbfrm.S_fax_country_code.value.length == 0)
				document.dbfrm.S_fax_country_code.value = Values[11];
			if (document.dbfrm.S_fax_area_code.value.length == 0)
				document.dbfrm.S_fax_area_code.value = Values[12];
		}
	}
	return true;
}

function setCookie(name, value)
{
	if (value.length > 0)
		document.cookie = name + "=" + escape(value)+ ";"+"expires=" + expires.toGMTString()+";"
}

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

function get_ccode()
{
	document.dbfrm.S_fax_country_code.value = document.dbfrm.S_phone_country_code.value;
}

function get_acode()
{
	document.dbfrm.S_fax_area_code.value = document.dbfrm.S_phone_area_code.value;
}


function ShowHide(id) {
	var array=id.split("_");
	if(array && array.length > 0)
	{
		for(i=0; i < array.length; i++)
		{
			var divs = document.getElementById(array[i]);
			var myid='img_'+array[i];
			if (divs.style.display == "none" )
			{
				divs.style.display = "block";
				document.getElementById(myid).src="/gifs/minus.gif";
			}
			else
			{
				divs.style.display = "none"
				document.getElementById(myid).src="/gifs/plus.gif";
			}
		}
	}
	else
	{
		var divs = document.getElementById(id);
		var myid='img_'+id;
		if (divs[i].style.display == "none" )
		{
			divs[i].style.display = "block";
			document.getElementById(myid).src="/gifs/minus.gif";
		}
		else
		{
			divs[i].style.display = "none";
			document.getElementById(myid).src="/gifs/plus.gif";
		}
	}
}

function NewShowHide(id) {

	if(document.getElementsByName )
	{
		var temp;
		var newarray= id.split(' ');
		for(var j= 0;  j <  newarray.length; j++)
		{
			temp=newarray[j];
			var divs = document.getElementsByName( temp );
			if(divs && divs.length > 0 )
			{
				for(var i=0;i<divs.length;i++ )
				{
					if (divs[i].style.display == "none" )
					{
						divs[i].style.display = "block";
					}
					else
					{
						divs[i].style.display = "none";
					}
				}
			}
		}
	}
}


var openurl='';
var alto=100;
var ancho=100;
var anchofinal,altofinal=0;
var incremento=0;
var incx=0;
var incy=0;

function freescalar(url1,url2,posx,posy,wfinal,hfinal,inc)
  {
    win2=open(url1,'win2','resizable=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,width=100,height=100,left='+posx+',top='+posy+',screenLeft='+posx+',screenTop='+posy);
    if (!document.layers&&!document.all)
      {
        win2.location=url2;
        return
      }
    anchofinal=wfinal;
    altofinal=hfinal;
    openurl=url2;
    incremento=inc;
    incx=inc;
    incy=inc;
    reescalar();
  }

function reescalar()
  {
    if ((alto<=altofinal)||(ancho<=anchofinal))
      {
        if (ancho>anchofinal) {incx=0}
        if (alto>altofinal) {incy=0}
        win2.resizeBy(incx,incy);
        ancho+=incx;
        alto+=incy;

        setTimeout("reescalar()",50);
      }
    else
      {ancho=100;alto=100;win2.location=openurl;}
  }
//---------------------------------------------- FIN DE RUTINA -------------------------------------------//


//<!--
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','background-Color=#FFFFCC,toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=180,height=180');
        msgWindow.focus();
        msgWindow.location.href = thisurl;
}
else {
        msgWindow=window.open( thisurl,'subwindow','background-Color=#FFFFCC,toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=540,height=900');
}

}



function openchild1(thisurl){
if ( CanAnimate ){
        msgWindow=window.open( '' ,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=no,menubar=no,resizable=yes,width=660,height=490');
        msgWindow.focus();
        msgWindow.location.href = thisurl;
}
else {
        msgWindow=window.open( thisurl,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=no,menubar=no,resizable=yes,width=660,height=490');
}





}
//-->



//<!--
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 openchild1(thisurl, v_width, v_height,subwindow)
{
   if (v_width <= 0)     {
       v_width='500';
   }
   if (v_height <= 0)     {
       v_height='500';
   }
   if (subwindow='')
   {
       subwindow = 'subwindow';
   }
   if ( CanAnimate )
   {
       msgWindow=window.open( '' ,subwindow,'left=0,top=0,toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=' + v_width + ',height=' + v_height);
       msgWindow.focus();
       msgWindow.location.href = thisurl;
   }
   else
   {
       msgWindow=window.open( thisurl,subwindow,'left=0,top=0,toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=' + v_width + ',height=' + v_height);
   }
}
