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_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;
}

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_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_openBrWindow(theURL,winName,features) { //v2.0
  return window.open(theURL,winName,features);
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

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();
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
	if (checkIt('mac')&&v=='visible') obj.pixelTop = obj.pixelTop ;
    obj.visibility=v; }
}

function checkIt(string) {
	var detect = navigator.userAgent.toLowerCase();
	return detect.indexOf(string) + 1;
}


function printImg( image ) {
	document.write( '<img src="' + image.src + '" alt="' + image.alt + '" width="' + image.width + '" height="' + image.height + '" border="0">' ) ;
}
//////layer zoom
function creeazaLayer( i ) {
	var pic= i;
	return pic;
	
}
//////////////////////

function featureZoom( modelKey, featureKey ) {
	var params = "toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=0,resizable=0,top=20,left=20,screenX=20,screenY=20,width=466,height=314";
	var url = "featureZoom.jsp?model=" + modelKey + "&feature=" + featureKey;
	window.open( url, "featureZoom", params, true );
}

function cadillacCollection() {
	var newWindow=MM_openBrWindow('http://www.cadillaccollection.com','_cadillacCollection','');
	newWindow.focus();
}


function subnav(daLayer){

	//alert("this layer=" + daLayer);
	//alert("last layer=" + daLast);
	
	if ( daLayer == 'subnavnone' ) {
		onLayer = false;
	} else {
		onLayer = true;
	}
	
	clearTimeout(subnavTimer);
	subnavTimer = setTimeout("subnavclear()", subnavTimeout);

	if (daLayer != daLast) {

		if (document.layers) {
			document.layers[daLast].visibility = hidden;

		} else if (document.all) {
			document.all(daLast).style.visibility = hidden;
        
		} else if (document.getElementById) {
			document.getElementById(daLast).style.visibility = hidden;
        
		} daLast = daLayer;

	}

	if (document.layers) {
		document.layers[daLayer].visibility = visible;
        
	} else if (document.all) {
		document.all(daLayer).style.visibility = visible;
        
	} else if (document.getElementById) {
		document.getElementById(daLayer).style.visibility = visible;
        
	}
}


//Image51
function picHighLight(name,state) {
if(state=='on'){
document[name].src="images/mini_83.jpg";
}
else {
document[name].src="images/mini_up_83.jpg";
}
}

//Image50
function picHighLight2(name,state) {
if(state=='on'){
document[name].src="images/mini_81.jpg";
}
else {
document[name].src="images/mini_up_81.jpg";
}
}

//Image49
function picHighLight3(name,state) {
if(state=='on'){
document[name].src="images/mini_79.jpg";
}
else {
document[name].src="images/mini_up_79.jpg";
}
}

function trim(obj) { 
	var cont=obj.replace(/\s+$|^\s+/g,"");	
	if(cont=='')
		{
			return 0;			
		}
	else
		{
			return 1;	
		}
} 

function ltrim() { 
return this.replace(/^\s+/,""); 
} 

function rtrim() { 
return this.replace(/\s+$/,""); 
} 

function verifMail(){
	var name=document.contact.email.value;
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	if (filter.test(name))
	{
	return true;
	}
	else
	{
	return false;
	}
}

function verifMail2(){
	var name=document.drivetest.email.value;
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	if (filter.test(name))
	{
	return true;
	}
	else
	{
	return false;
	}
}
function markLink(index,max)
{
	for(i=1;i<=max;i++){
	document.getElementById('linkDetail'+ i).style.color="#3B4757";
	}
	document.getElementById('linkDetail'+index).style.color="#FF6000";
}

function verificaFormular()
  {
    if (document.contact.nume.value == "" || trim(document.contact.nume.value)==0)
	 {
	  alert("Nu ati completat campul nume.");
	  document.contact.nume.value="";
	  document.contact.nume.focus();
	  return false;
	 }
	if (document.contact.email.value == "" || trim(document.contact.email.value)==0 || !verifMail())
	 {
	  alert("Nu ati completat campul e-mail.");
	  document.contact.email.value="";
	  document.contact.email.focus();
	  return false;
	 }
	if (document.contact.companie.value == "" || trim(document.contact.companie.value)==0)
	 {
	  alert("Nu ati completat campul companie.");
	  document.contact.companie.value="";
	  document.contact.companie.focus();
	  return false;
	 }
	if (document.contact.telefon.value == "" || trim(document.contact.telefon.value)==0)
	 {
	  alert("Nu ati completat campul telefon.");
	  document.contact.telefon.value="";
	  document.contact.telefon.focus();
	  return false;
	 }
	if (document.contact.oras.value == "" || trim(document.contact.oras.value)==0)
	 {
	  alert("Nu ati completat campul oras.");
	  document.contact.oras.value="";
	  document.contact.oras.focus();
	  return false;
	 }
	if (document.contact.mesaj.value == "" || trim(document.contact.mesaj.value)==0)
	 {
	  alert("Care este mesajul dumneavostra?");
	  document.contact.mesaj.value="";
	  document.contact.mesaj.focus();
	  return false;
	 }
  }

  function verificaFormular2()
  {
    if (document.drivetest.nume.value == "" || trim(document.drivetest.nume.value)==0)
	 {
	  alert("Nu ati completat campul nume.");
	  document.drivetest.nume.value="";
	  document.drivetest.nume.focus();
	  return false;
	 }
	if (document.drivetest.prenume.value == "" || trim(document.drivetest.prenume.value)==0)
	 {
	  alert("Nu ati completat campul prenume.");
	  document.drivetest.prenume.value="";
	  document.drivetest.prenume.focus();
	  return false;
	 }
	if (document.drivetest.oras.value == "" || trim(document.drivetest.oras.value)==0)
	 {
	  alert("Nu ati completat campul oras.");
	  document.drivetest.oras.value="";
	  document.drivetest.oras.focus();
	  return false;
	 }
	if (document.drivetest.telefon.value == "" || trim(document.drivetest.telefon.value)==0)
	 {
	  alert("Nu ati completat campul telefon.");
	  document.drivetest.telefon.value="";
	  document.drivetest.telefon.focus();
	  return false;
	 }
	if (document.drivetest.email.value == "" || trim(document.drivetest.email.value)==0 || !verifMail2())
	 {
	  alert("Nu ati completat campul e-mail.");
	  document.drivetest.email.value="";
	  document.drivetest.email.focus();
	  return false;
	 }	
 }