var adid;
var nxtLvl;
imgld = true;
var oldActEl = '';

function hlt(o,c,r){
  highlight(o,c,r);
	return;
}
function prt(o,n,m){
	printRight(o,n,m);
	return;
}
function st(){
   return;
}
function errorHandler(message, url, line){
	if ( message == 'Permission denied' )
		window.location=('http://<%=Request.ServerVariables("SERVER_NAME") & Application("PathFromRoot")%>');
	return true;
}
//Write to Window
function ww(w,s){ 
	w.open(); 
	w.write(s);
	w.close(); 
	return; 
}
function getCki(i){
	a = (document.cookie).split(';');
	for(j=0;j<a.length;j++){
		if ( a[j].indexOf('&lp=') > 0 ){
			r = (a[j]).split('&');
			return( (i>=r.length) ? '' : r[i].substring(r[i].indexOf('=')+1,r[i].length) );
	}}
	return '';
}
function chgAllImg(){
   chgImg();
   return;
}
function chgImg(){
	window.location='ad.html?'+(new Date()).getTime();
	return;
}
function printRight(o,sMode,sComp){

	s  = '<form name="rForm">'+
		  '<input type="hidden" name="mode" value="'+sMode+'" /><input type="hidden" name="comp" value="'+sComp+'" />'+
		  '<div class="hd">'+sComp+'<hr size="1" /></div>'
	
	if ( sMode != d.notSearchable )
	 s+=	'<div class="right_block" onmouseover="document.rform.srch.focus()"><table class="tbl">'+
			  '<tr><th>'+d.PART_NUMBER+'</th></tr>'+
			  '<tr><td align="center"><input type="text" name="srch" size="20" maxlength="50" value="" /></td></tr>'+
			  '<tr><td align="center"><input type="button" value="'+d.SUGGEST+'" onclick="Javascript:rForm.srch.value=rForm.mode.value" />'+
			  '</td></tr></table></div>';
	
	s += '<div class="txt"><table class="mfr_info"><tr><td>'+replc(d.HAVE_SELECTED_COMPANY,'<!--[MANUFACTURER NAME]-->',sComp,true)+' ';
	
	if ( sMode != d.notSearchable ){
		s += d.SITE_IS_SEARCHABLE + ' ' + replc(d.CLICK_TO_SUGGEST,'<!--[MANUFACTURER NAME]-->',sComp,true)+'<p>'+d.CLICK_TO_SEARCH+'</p></div><div style="clear:both;">';
	} else 			
		s += d.CLK_TO_PROCEED_BLOCK+'<input type="hidden" name="srch" value="" /></div><div>';

	s += '</td></tr></table><hr size="1" /><input type="button" name="smbt" value="'+d.LOCATE+'" onclick="srchit(); return false;" />'+
		  '</form><img src="mfr.html" width="14" height="14" /></div>';

	//ww(top.search.document,s);
	//top.heading.window.chgAllImg();
	//doBS(o,sMode);
	
	document.getElementById("welcome").innerHTML = s;
	
	highlight(o,"list-on",0);
	
	return;
}
function replc(str,rep,wth,global){
	for(i=0;i<=(str.length-rep.length+1);i++){
		if (str.substring(i,i+rep.length)==rep){
			str=str.substring(0,i)+wth+str.substring(i+rep.length);
			if(!global)return str;
	}}
	return str;
}
function alrt(s,type){
	var loc = 'alert.html?comp='+escape(s)+'&type='+type;
	window.open(loc,'','top=23,left=1,height=200,width=350,resizable=1,scrollbars=1,status=0,toolbar=no,menubar=no,location=no');
	return;
}
function setFilter(){
	document.cookie='lt=list&lp='+getCki(1)+'&lm='+getCki(2)+'&lf='+document.f.filter.value;
	s = new String(document.f.filter.value);
	s = s.toUpperCase();
	o=document.getElementById("compList");
	for(i=o.rows.length-1;i>=0;i--) {
		a = o.rows[i].cells[0].id;
		o.rows[i].style.display = ((((document.getElementById('a'+a).innerHTML).toUpperCase())).substring(0,s.length) == s )
			? '' : 'none';
	}
	return;
}
function highlight(o,c,overrule){
	if ( overrule == 1 || o != oldActEl ) {
		o.className=c;
		oldActEl.className = "list";
		oldActEl = o;
	}
	return;
}
function doBS(o,sMode){
	((window.oldActEl)&&(highlight(window.oldActEl,"list",1)));
	highlight(o,"list-selected",1);
	window.oldActEl=o;
	(sMode==t.notSearchable)?document.rForm.smbt.focus():document.rForm.srch.focus();
	return;
}
function chgAdID(id){
   adid  = id;
   imgld = true;
   return;
}
function adOpen(pg,md){
	if (imgld) winOpen(pg,md);
	return;	
}
function winOpen(pg,md){
	ew = 12; pw = 315; ph = 145; lbf = 0; mw = 780; mh = 480;
	std = ',top='+(23*nxtLvl)+',left=1,scrollbars=1,location=no,resizable=yes,';

	if(md==1)p='height='+mh+',width='+(mw-(lbf*2))+std+'status=no,menubar=yes,toolbar=yes';//external
	if(md==2)p='height=400,width=600'+std+'status=no,menubar=no,toolbar=no';
	if(md==6)p='height='+mh+',width='+(mw-(lbf*2))+std+'status=yes,menubar=no,toolbar=no';//reg	
	if(md==7)p='height='+mh+',width='+(mw-(lbf*2))+std+'status=no,menubar=no,toolbar=no';//local
	if(md==8)p='height='+ph+',width='+pw+',top='+(23*nxtLvl)+',left=1,scrollbars=1,location=no,resizable=yes,status=no,menubar=no,toolbar=no';//prompt
	if(md==9)p='height=1,width=1,top='+(23*nxtLvl)+',left=1,scrollbars=1,location=no,resizable=no,status=no,menubar=no,toolbar=no';//tiny

	win = winLoad(pg,p,md,1);
	eval(win+'.focus()');
	return;
}
function winLoad(pg,p,md,i){
	win = 'win'+md+'_'+nxtLvl+'_'+i;
	try{
		if (eval(win+'.closed == true')){
			i=i+1;
			winLoad(pg,p,md,i);
		} else { throw 'Does not exist'	}
	}
	catch(er)
	{
	//	try       { eval (win+'.location = pg') }
	//	catch(er) {
		   pg = ( pg.indexOf('http') == -1 ? '/common/new.htm?'+pg : pg );
		   eval (win+' = window.open(pg,"'+win+'",p)') ;
	//	}
	}
	return win;
}
function omo(s1,s2,s3){
   return;
}

function getOutput(tDiv, sDiv) {
	document.getElementById(tDiv).innerHTML=document.getElementById(sDiv).innerHTML;
	return false;
}

function doSuggest(o) {
	var q = "m="+escape(o.m.value)+"&ses="+escape(o.ses.value)+"&txtName="+escape(o.txtName.value)+"&txtURL="+escape(o.txtURL.value)+"&txaCmts="+escape(o.txaCmts.value);
	window.open('dsl.html?'+q,'newwindow','height=480,width=800,top=23,left=1,scrollbars=1,location=no,resizable=yes,status=no,menubar=yes,toolbar=yes');
}
