

<!--

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

expires = new Date();
expires.setTime (expires.getTime() + 24 * 60 * 60 * 150 * 1000);

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

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

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


extArray = new Array(".doc", ".gif", ".jpg", ".pjpg", ".jpeg", ".pjpeg", ".png", ".xls", ".pdf", ".psd", ".ppt", ".swf", ".txt");
	var file=document.dbfrm.attachment.value;
	allowupload = false;
	if(file){
		while (file.indexOf("\\") != -1)
		file = file.slice(file.indexOf("\\") + 1);
		ext = file.slice(file.indexOf(".")).toLowerCase();
		for (var i = 0; i < extArray.length; i++)
		{
			if(extArray[i] == ext)
			{
				allowupload = true;
				break;
			}
		}
		if (!allowupload)
		{
			alert("Please upload attachment with correct file format or leave this field blank.");
			return (false);
		}
	}

	if(document.dbfrm.fname.value == '')
	{
		alert("Please Enter Your First Name");
		document.dbfrm.fname.focus();
		return (false);
	}

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

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

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

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

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

function freelist_form_chk()
{
	if(document.dbfrm.Description.value == '')
	{
		alert("Please Enter The Description");
		document.dbfrm.Description.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_streetaddress.value == '')
	{
		alert("Please Enter Your Street Address");
		document.dbfrm.S_streetaddress.focus();
		return (false);
	}

	if(document.dbfrm.S_city.value == '')
	{
		alert("Please Enter Your City");
		document.dbfrm.S_city.focus();
		return (false);
	}

	if(document.dbfrm.S_pin.value == '')
	{
		alert("Please Enter Your Pin Number");
		document.dbfrm.S_pin.focus();
		return (false);
	}

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

function adv_form_chk()
{
	if(document.dbfrm.Banner_Advertising.checked==false &&
	document.dbfrm.Newsletter_Programme.checked==false && document.dbfrm.Premium_Listing.checked==false &&
	document.dbfrm.Private_Buyer_Catalog.checked==false && document.dbfrm.Featured_Catalog_Promotion.checked==false)
	{
		alert("Please Select atleast one Advertising Options");
		return (false);
	}

	if(document.dbfrm.Comments.value == '')
	{
		alert("Please Enter Your Advertising Needs");
		document.dbfrm.Comments.focus();
		return (false);
	}

	if(document.dbfrm.S_organization.value == '')
	{
		alert("Please Enter Organization/Company Name");
		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_city.value == '')
	{
		alert("Please Enter Your City");
		document.dbfrm.S_city.focus();
		return (false);
	}

	if(document.dbfrm.S_state.value == '')
	{
		alert("Please Enter Your State");
		document.dbfrm.S_state.focus();
		return (false);
	}

	if (document.dbfrm.country.selectedIndex == 0)
	{
		alert("Kindly Select Country.");
		document.dbfrm.country.focus();
		return (false);
	}
	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 getCcode()
{
	document.dbfrm.S_fax_country_code.value = document.dbfrm.S_phone_country_code.value;
}

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

function get_ccode()
{
	document.dbfrm.fax_country_code.value = document.dbfrm.phone_country_code.value;

}

function get_acode()
{
	document.dbfrm.fax_area_code.value = document.dbfrm.phone_area_code.value;
}



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

function getProductNews(host)
{
	var index=document.dataform.subcat.selectedIndex;
	var url=document.dataform.subcat.options[index].value;

	document.dataform.action= 'http://'+host+'/'+url+'/';
	document.dataform.target= "_TOP"
	document.dataform.submit();
	//window.location.href='http://'+host+'/'+url+'/';
	return false;
}


//------------------------------ RUTINA PARA ABRIR Y REESCALAR UNA VENTANA --------------------------//
// La llamada a la rutina se efecta de la siguiente forma:
//
//	freescalar(url1,url2,posx,posy,ancho,alto,inc)	siendo:
//
//	url1: url de la p?ina cargada inicialmente mientras se reescala la ventana
//	url2: url de la p?ina que se cargar?en la ventana una vez haya terminado de reescalarse
//	posx: coordenada x en la que queremos situar la ventana
//	posy: coordenada y en la que queremos situar la ventana
//	ancho: ancho final de la ventana
//	alto: ancho final de la ventana
//	inc: incremento en pixels de reescalado de la ventana

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

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


function getblank(this1)  {
	if (this1.value == "Your e-mail here") {
		this1.value = "";
	}
	return true;
}

function getblank1(this1)  {
	if (this1.value == "Your name here") {
		this1.value = "";
	}
	return true;
}


function checkemail(){
var testresults='';
var str=document.forms.validation['newletter_form'].elements['email'].value
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str))
testresults=true
else{
alert("Please input a valid email address!")
testresults=false
}
return (testresults)
}


//this is java script check for the e-mail validation in the right navigation
function feedback1(dbfrm)
{
	if(dbfrm.S_name.value == '')
	{
		alert("Please Enter Your Name");
		dbfrm.S_name.focus();
		return (false);
	}

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

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

	if(dbfrm.comments.value == '')
	{
		alert("Please Enter The Comments");
		dbfrm.comments.focus();
		return (false);
	}
}

function error_report(dbfrm)
{
	for (counter = 0; counter < dbfrm.Error_type.length; counter++)
	{
		if (dbfrm.Error_type[counter].checked)
		{
			var radio_val=dbfrm.Error_type[counter].value;
		}
	}
	if (dbfrm.Error_type.length > 0 && !radio_val)
	{
		alert("Please Select Error Type");
		return (false);
	}


	if(dbfrm.Adderss_resource.value == '')
	{
		alert("Please Enter Address of The Page or Resource");
		dbfrm.Adderss_resource.focus();
		return (false);
	}
}

function validEmail(dbfrm,url,host)
{
	if (dbfrm.name.value == '' || dbfrm.name.value == 'Your name here')
	{
		alert("Kindly Enter Your Name.");
		dbfrm.name.focus();
		return (false);
	}

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

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

	if(url && host)
	{
	thisurl='http://'+host+url+'?action=Subscribe&email='+dbfrm.email.value+'&name='+dbfrm.name.value;
		//thisurl='http://'+host+url+'?action=Subscribe&email='+dbfrm.email.value;
		window.open( thisurl,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=no,menubar=no,resizable=yes,width=470,height=210');
		return false;
	}
	return false;
}

//for getting the right Navigation
