function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}


function MM_setTextOfLayer(objName,Type,filename,attrb,alink) { //v4.01

	if (Type=="Flash") {
 
		var bannerText="<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' "+attrb+"  classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000>  <PARAM NAME='movie' VALUE='"+filename+"?link="+alink+"'>              <PARAM NAME='quality' VALUE='high'> <PARAM NAME='bgcolor' > <embed src='"+filename+"?link="+alink+"' quality='high' align='middle' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' "+attrb+"/></OBJECT>"; 
		/*
		var bannerText="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' "+attrb+">
	<param name='movie' value='"+filename+"?link="+alink+"'>
	<param name='quality' value='high'>
	<embed src='"+filename+"?link="+alink+"' quality='high' pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" "+attrb+"></embed>
	</object>";
	*/
	}
	else {
		bannerText="<a href='"+alink+"' target='_blank'><img src="+filename+" "+attrb+" border=0></a>"
	}
	if ((obj=MM_findObj(objName))!=null) with (obj)
    if (document.layers) {document.write(unescape(bannerText)); document.close();}
    else innerHTML = unescape(bannerText);

}

function search_valid_index(chk2) {
		
   	if ( chktrim(chk2.term.value).length <=1 || ( chktrim(chk2.term.value).length >=1 && chk2.term.value=="Enter Search Keywords")) {
		alert("Enter Product / Services Keyword(s)");
      	chk2.term.focus();
	  	return false;
   	} 
}

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 preloadImages() { //preloadImage function starts
	if(document.images) {
		src=preloadImages.arguments;
		for(i=0; i<src.length; i++) {
			var img='pic'+i;
			img=new Image();
			img.src='images_iyp/'+src[i]+'_over.gif';
		}
	}
} // preloadImages function ends

function over(img) {
	a=img.src.replace('.gif', '_over.gif');
	img.src=a;
}
function out(img) {
	a=img.src.replace('_over.gif', '.gif');
	img.src=a;
}

function MM_setLiveChatLayer(objName,TxtMatter) { //v4.01

	if ((obj=MM_findObj(objName))!=null) with (obj)

    if (document.layers) {
	    document.write(unescape(TxtMatter)); document.close();
	}
    else { 
	    innerHTML = unescape(TxtMatter);
    }

}

// it is userd for images on header-html
if (document.images)
{
  topHome= new Image; 
  topHome.src="/images_1/topHome.gif"; 
  topHomeOver= new Image; 
  topHomeOver.src="/images_1/topHomeOver.gif"; 

  topContact= new Image; 
  topContact.src="/images_1/topContact.gif"; 
  topContactOver= new Image; 
  topContactOver.src="/images_1/topContactOver.gif"; 

  topLogin= new Image; 
  topLogin.src="/images_1/topLogin.gif"; 
  topLoginOver= new Image; 
  topLoginOver.src="/images_1/topLoginOver.gif"; 

  topJoin= new Image; 
  topJoin.src="/images_1/topJoin.gif";
  topJoinOver= new Image; 
  topJoinOver.src="/images_1/topJoinOver.gif"; 
  
  topEnquiry= new Image; 
  topEnquiry.src="/images_1/topEnquiry.gif"; 
  topEnquiryOver= new Image; 
  topEnquiryOver.src="/images_1/topEnquiryOver.gif"; 
  
  topHelp= new Image; 
  topHelp.src="/images_1/topHelp.gif"; 
  topHelpOver= new Image; 
  topHelpOver.src="/images_1/topHelpOver.gif"; 
  
  topMyFolder= new Image; 
  topMyFolder.src="/images_1/topMyFolder.gif"; 
  topMyFolderOver= new Image; 
  topMyFolderOver.src="/images_1/topMyFolderOver.gif"; 
  
  topLogout= new Image; 
  topLogout.src="/images_1/topLogout.gif"; 
  topLogoutOver= new Image; 
  topLogoutOver.src="/images_1/topLogoutOver.gif";   
  
  
  topProLin01= new Image; 
  topProLin01.src="/images_1/topProLin01.gif"; 
  topProLin01Over= new Image; 
  topProLin01Over.src="/images_1/topProLin01Over.gif"; 
  
  topProLin02= new Image; 
  topProLin02.src="/images_1/topProLin02.gif"; 
  topProLin02Over= new Image; 
  topProLin02Over.src="/images_1/topProLin02Over.gif"; 
  
  topProLin03= new Image; 
  topProLin03.src="/images_1/topProLin03.gif"; 
  topProLin03Over= new Image; 
  topProLin03Over.src="/images_1/topProLin03Over.gif"; 
  
  topProLin04= new Image; 
  topProLin04.src="/images_1/topProLin04.gif"; 
  topProLin04Over= new Image; 
  topProLin04Over.src="/images_1/topProLin04Over.gif"; 
}


function mOver(picName)
{
	if (document.images)
	{
		picOver=eval(picName + "Over.src");
		document[picName].src=picOver;
	}
}


function mOut(picName)
{
	if (document.images)
	{
		picOver=eval(picName + ".src");
		document[picName].src=picOver;
	}
}

function preloader()  {
	var i = 0;
	imageObj = new Image();
	images = new Array();
	images[0]="tpl_classifieds.gif";
	images[1]="tpl_trade_leads.gif";
	images[2]="tpl_products_over.gif";
	images[3]="tpl_catalogs.gif";
	images[4]="tpl_advertisement.gif";
	for(i=0; i<=3; i++) {
		imageObj.src=images[i];
	}
} 

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

  	var win = window.open(''+rUrl+'/email_with_us.htm?sendurl=' + target, 'notice', 'width=600,height=500,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.indianyellowpages.com');
	}
	else {
		alert('To set Indianyellowpages.com as your home page in Firefox, click and drag the button to the "Home" icon in your browser.');
	}
	return false;
}

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

