/* transexpress */

// Macromedia functions

function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v3.0
  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); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

// functions for stylesheets

	var ie;
	var ns;

	function writeiecss(){
		document.writeln('<style>');
		document.writeln('input.search { height:15px; width:120px; border:1px dotted; font-size:7pt; color:#30419A}');
		document.writeln('select.scategory { border:1px; bordercolor:#efefe; font-size:7pt; color:#FFFFFF; background-color:#30419A}');
		document.writeln ('.input { height:19px; width:70px; font-size:6pt; border-bottom-margin:0px; border-top-margin:0px; border-left-margin:0px; border-right-margin:0px; background-color:#30419A; color:#FFFFFF}');
		document.writeln('<\/style>');
		}
	
	function writenscss(){
		document.writeln('<style type="text/css">');
		document.writeln('select.scategory { font-size:7pt}');
		document.writeln ('.input { height:19px; font-size:7pt}');
		document.writeln('<\/style>');
		}
			ie = ((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>=4));
			ns = ((navigator.appName=="Netscape") && (parseInt(navigator.appVersion)>=4));
		
		if ((ie))
			writeiecss();
		
		if ((ns))
			writenscss();
	
function openWin(url){

  var w=640, h=480;
  //var windowName=new //String(contador);
  //windowName="w"+windowName;
		
  if ( window.screen && window.screen.availHeight ) {
    h = window.screen.availHeight - 230;
    w = window.screen.availWidth - 10;
  }

  var banner = window.open("/yellowpages/html/yellow/index.asp", "window", "resizable=no,toolbar=no,scrollbars=no,location=no,status=no,top=0,left=0,width="+w+",height=75");
  var winurl = window.open(url, "win", "resizable=yes,toolbar=yes,scrollbars=yes,location=no,status=yes,top=130,left=0,width="+w+",height="+h );
  
  banner.focus();
  winurl.focus();
  }

function valComments(xForm){
  if (trim(xForm.FirstName.value) == ""){
    xForm.FirstName.value = trim(xForm.FirstName.value);
	alert("Please, your First Name is required");
	xForm.FirstName.focus();
    return false;
  }
  if (trim(xForm.LastName.value) == ""){
    xForm.LastName.value = trim(xForm.LastName.value);
	alert("Please, your Last Name is required");
	xForm.LastName.focus();
    return false;	
  }
  if (trim(xForm.Email.value) == ""){
    xForm.Email.value = trim(xForm.Email.value);
	alert("Please, your Email address is required");
	xForm.Email.focus();
    return false;	
  }
  var val = xForm.Email.value;
  var p= val.indexOf('@');
  if (p<1 || p==(val.length-1)) {
	 xForm.Email.select();
	 alert(xForm.Email.value + " is not a valid E-Mail");
	 return false;
  }	
  if (trim(xForm.Comments.value) == ""){
    xForm.Comments.value = trim(xForm.Comments.value);
	alert("Please, your Comments are required");
	xForm.Comments.focus();
    return false;	
  }
			  
}

function valServiceRequest(xForm){
  if (trim(xForm.FirstName.value) == ""){
    xForm.FirstName.value = trim(xForm.FirstName.value);
	alert("Please, your First Name is required");
	xForm.FirstName.focus();
    return false;
  }
  if (trim(xForm.LastName.value) == ""){
    xForm.LastName.value = trim(xForm.LastName.value);
	alert("Please, your Last Name is required");
	xForm.LastName.focus();
    return false;	
  }
  if (trim(xForm.Address.value) == ""){
    xForm.Address.value = trim(xForm.Address.value);
	alert("Please, your Address is required");
	xForm.Address.focus();
    return false;
  }
  if (trim(xForm.City.value) == ""){
    xForm.City.value = trim(xForm.City.value);
	alert("Please, your City is required");
	xForm.City.focus();
    return false;	
  }
  if (trim(xForm.State.value) == ""){
    xForm.State.value = trim(xForm.State.value);
	alert("Please, your State is required");
	xForm.State.focus();
    return false;	
  }
  if (trim(xForm.Email.value) == ""){
    xForm.Email.value = trim(xForm.Email.value);
	alert("Please, your Email address is required");
	xForm.Email.focus();
    return false;	
  }
  var val = xForm.Email.value;
  var p= val.indexOf('@');
  if (p<1 || p==(val.length-1)) {
	 xForm.Email.select();
	 alert(xForm.Email.value + " is not a valid E-Mail");
	 return false;
  }	
  if (trim(xForm.Email.value) != trim(xForm.Email2.value)){
    xForm.Email.value = trim(xForm.Email.value);
	alert("Please, your Email and its confirmation must be the same");
	xForm.Email.focus();
    return false;	
  }  
}

function trim(str) {
  str = str.replace (/\s/g, "");
  return str; 
}

function focusWin( pageToLoad, winName ) {                              
    window.open( pageToLoad, winName );
	window.blur();
}

function formLoad() {
     xForm = document.MCON;
	for (var i=0; i<xForm.elements.length; i++){
		var e = xForm.elements[i];
		if ((e.type == 'text') && (e.disabled == 0)){
		    e.focus();
		    return;
		}
	}
}


