function emailThisPage(rUrl) {
    var target = document.location;

  	var win = window.open(''+rUrl+'/email_with_us.htm?sendurl=' + target, 'notice', 'width=600,height=450,location=no,toolbar=no,status=no,resizable=no,scrollbars=yes');
  	win.focus();
}

function addToFavorite(){
	
	var titleVar = document.title;
	
	var urlVar = document.location;
	
	// firefox
	if (window.sidebar) {
		window.sidebar.addPanel(titleVar, urlVar, "");
	}
	// opera
	else if(window.opera && window.print) { 
		var elem = document.createElement('a');
		elem.setAttribute('href',urlVar);
		elem.setAttribute('title',titleVar);
		elem.setAttribute('rel','sidebar');
		elem.click();
	} 
	// ie
	else  {
		window.external.AddFavorite(urlVar,titleVar)
	}	

}

function firefoxAlert(pageurl) {
	
	if(navigator.appName=="Microsoft Internet Explorer") {
		
		pageurl.style.behavior='url(#default#homepage)';pageurl.setHomePage('http://www.exportersindia.com');
	}
	else {
		alert('To set ExportersIndia.com as your home page in Firefox, click and drag the button to the "Home" icon in your browser.');
	}
	return false;
}
function setWidth() {	
	
	var screenWidth=screen.width;
	
	if(screenWidth>=1024) {
		document.getElementById('body').style.width='990px';
	}
	else {
		document.getElementById('body').style.width='770px';
	}	
}

function chktrim(inputString) {
	if (typeof inputString != "string") { 
		return inputString; 
	}
    var retValue = inputString;
    var ch = retValue.substring(0, 1);
    while (ch == " ") { 
    	retValue = retValue.substring(1, retValue.length);
        ch = retValue.substring(0, 1);
    } 
    ch = retValue.substring(retValue.length-1, retValue.length);
	while (ch == " ") { 
    	retValue = retValue.substring(0, retValue.length-1);
        ch = retValue.substring(retValue.length-1, retValue.length);
	}
    while (retValue.indexOf("  ") != -1) { 
    	retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
	}
    return retValue; 
}

function catg_search(chk1) {
	
   	if ( chktrim(chk1.term.value).length <=1 || ( chktrim(chk1.term.value).length >=1 && chk1.term.value=="Enter Keywords here . . .")) {
		alert("Enter Product / Services Keyword(s)");
      	chk1.term.focus();
	  	return false;
   	}
   	if (chk1.srch_catg_ty.options[chk1.srch_catg_ty.selectedIndex].value == "") {
      	alert("Select a Searching Category");
      	chk1.srch_catg_ty.focus();
	  	return false;
   	}   
   	if (chk1.srch_catg_ty.options[chk1.srch_catg_ty.selectedIndex].value == "BC") {
      	alert("Please Select Type Of Bussiness Classified");
      	chk1.srch_catg_ty.focus();
	  	return false;
   	}   
}

function checkAll(val) {
   	dml=document.form1;
   	len=dml.elements.length;
   	var i=0;
   	for (i=0; i<len; i++) {
     	if (document.form1.elements[i].type == "checkbox") {
        	if (val == 1) {
           		dml.elements[i].checked=true;
        	} 
			else {
           		dml.elements[i].checked=false;
        	}
     	}   
   	}
}

function addto_basket() {
	var pp=1;
    dml=document.form1;
    len=dml.elements.length;
    var i=0;
    for(i=0; i<len; i++) {
      if (dml.elements[i].type == "checkbox" && dml.elements[i].name != "checked_1"  && dml.elements[i].checked==true) {
         pp=2;
      }
    }
    if (pp==1) {
      	alert("You have not selected any party.\n\nPlease select the parties & then proceed");
      	return false;
    }
    else {
      	document.form1.id.value="Add to Basket";
      	document.form1.target="";
      	document.form1.submit();
   }
}

function inquire_now() {
    var pp=1;
    dml=document.form1;
    len=dml.elements.length;
    var i=0;
    for(i=0; i<len; i++) {
       if (dml.elements[i].type == "checkbox" && dml.elements[i].name != "checked_1" && dml.elements[i].checked==true) {
          pp=2;
       }
    }
    if (pp==1) {
      alert("You have not selected any party.\n\nPlease select the parties && then proceed");
      return false;
    }
    else {
      document.form1.id.value="Send Inquiry Now";
      document.form1.target="";
      document.form1.submit();
    }
}

function clsiified_inq(var1, site_ty) {
	if (site_ty=="live") {
  		popupWin = window.open('http://www.exportersindia.com/members/search.php?'+var1+'', 'newwin', 'menubar=yes,toolbar=yes,location=yes,directories=yes,titlebar=yes,status=yes,scrollbars=yes,resizable=yes');
	}
	else {
  		popupWin = window.open('http://192.168.1.106/members/search.php?'+var1+'', 'newwin', 'menubar=yes,toolbar=yes,location=yes,directories=yes,titlebar=yes,status=yes,scrollbars=yes,resizable=yes');		
	}	
}

function openwin1(file,Iwidth,Iheight) {
      var newWin1=window.open(file,'nWin2','x=0,y=0,toolbar=no,location=no,directories=no,status=yes,scrollbars=yes, copyhistory=no,width='+Iwidth+',height='+Iheight+',screenX=0,screenY=0,left=20,top=20');
}