function validateRegister(){
	var message = "";

		if (document.form1.custname.value.length == 0) {
			if (message.length == 0) message = message + "Please enter : \n\n";
			message = message + "Customer Name\n";
			}
				if (document.form1.doyear.value == 0) {
			if (message.length == 0) message = message + "Please enter your: \n\n";
			message = message + "Year of Birth \n";
			}

			if (document.form1.dobday.value == 0) {
			if (message.length == 0) message = message + "Please enter your: \n\n";
			message = message + "Day of Birth \n";
			}
				if (document.form1.dofmonth.value == 0) {
			if (message.length == 0) message = message + "Please enter your: \n\n";
			message = message + "Month of Birth \n";
			}
			
			if (document.form1.carmod.value == 0) {
			if (message.length == 0) message = message + "Please enter your: \n\n";
			message = message + "Car model \n";
			}
			
		if (document.form1.downpay.value.length == 0) {
			if (message.length == 0) message = message + "Please enter your: \n\n";
			message = message + "Down Payment \n";
			}
			

		if (document.form1.purprice.value.length == 0) {
			if (message.length == 0) message = message + "Please enter your: \n\n";
			message = message + "Purchase Price\n";
			}

		if (document.form1.finperiod.value.length == 0) {
			if (message.length == 0) message = message + "Please enter : \n\n";
			message = message + " No.of monthly installments \n";
			}
			
			
			
			downpay=document.form1.downpay.value;
			finperiod=document.form1.finperiod.value;
			purprice=document.form1.purprice.value;

	if(message.length > 0) {
			alert(message);
			//return false;
			}
		else{
			//str='_pages'
			carSimulation('MourabahResult')
			}
}

function carSimulation(divid){
id = divid;
 writetxt('<table width=100% border=0 cellspacing=0 cellpadding=0><tr bgcolor><td  valign=top width=6><img src=images/spacer.gif height=60 width=1></td><td   valign=top align=center><img src=images/loading_ani2.gif?r=1></td><td width=1 valign=top >&nbsp;</td></tr></table>');
custname=document.form1.custname.value;
doyear=document.form1.doyear.value;
dobday=document.form1.dobday.value;
dofmonth=document.form1.dofmonth.value;
carmod=document.form1.carmod.value;
downpay=document.form1.downpay.value;
finperiod=document.form1.finperiod.value;
purprice=document.form1.purprice.value;


		loadXMLDoc('Car Simulation/_carSimulation.asp?custname='+custname+'&doyear='+doyear+'&dobday='+dobday+'&dofmonth='+dofmonth+'&carmod='+carmod+'&downpay='+downpay+'&purprice='+purprice+'&finperiod='+finperiod);
}




function  sendcv(){
document.cvform.action='SendForm.asp?flag=1'
document.cvform.submit()
	
}


function switchImage(imgName, imgSrc) 
{
  if (document.images)
  {
    if (imgSrc != "none")
    {
      document.images[imgName].src = imgSrc;
    }
  }
}	
var id;
function Converter(){
	var from;
	var to ;
	var thisamount;
	id='tocurrency';
	from=document.getElementById('from').value;
	to=document.getElementById('to').value
	thisamount=document.getElementById('amount').value
	//alert('from:'+from+'to:'+to+'amount'+thisamount)
		 writetxt('<table width=100% border=0 cellspacing=0 cellpadding=0><tr bgcolor><td  valign=top width=6><img src=images/spacer.gif height=60 width=1></td><td   valign=top align=center><img src=images/loading_ani2.gif?r=1></td><td width=1 valign=top >&nbsp;</td></tr></table>');

		loadXMLDoc('_convertor.php?thisamount='+thisamount+'&to='+to+'&from='+from);
}


function featpro(thisid,divid){
	 prdid=thisid;
	id=divid;
	//alert(divid)
	 writetxt('<table width=100% border=0 cellspacing=0 cellpadding=0><tr bgcolor><td  valign=top width=6><img src=images/spacer.gif height=60 width=1></td><td   valign=top align=center><img src=images/loading_ani2.gif?r=1></td><td width=1 valign=top >&nbsp;</td></tr></table>');
	loadXMLDoc('_featProg.asp?id='+prdid);
	
}


function printWin(flag,printid){
		if (flag==0 ){
			alert('this page is not suitable for printing')
		}else{
		popUpWindow("PrintPAge.asp?flag="+flag+"&pageid="+printid,400,200,770,505)
		}
}

function showRequest(){
		popUpWindow1("FinancingRequest.asp",400,100,754,650)
}
function ChangeTitle(text) {
   //var newtitle = document.form1.newtitle.value;
   var head1 = document.getElementById("head1");
   head1.firstChild.nodeValue=text;
   document.getElementById('thecontainer').style.display='none';	

}
var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)

{

  if(popUpWin)

  {

    if(!popUpWin.closed) popUpWin.close();

  }

  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');

}
function popUpWindow1(URLStr, left, top, width, height)

{

  if(popUpWin)

  {

    if(!popUpWin.closed) popUpWin.close();

  }

  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');

}
function newsletter(flag) {
	//document.body.style.filter='progid:DXImageTransform.Microsoft.Alpha( style=0,opacity=60)';
    roger=document.getElementById('LetterMail').value;
	popUpWindow("newsletter.asp?lang=<%= lang %>&flag="+flag,600,200,375,505)
		//document.getElementById('talbeid').style.filter='progid:DXImageTransform.Microsoft.Alpha( style=0,opacity=50)';

}
function sms(flag) {
	//document.body.style.filter='progid:DXImageTransform.Microsoft.Alpha( style=0,opacity=60)';
   // roger=document.getElementById('LetterMail').value;
	popUpWindow("sms.asp",600,200,375,505)
		//document.getElementById('talbeid').style.filter='progid:DXImageTransform.Microsoft.Alpha( style=0,opacity=50)';

}

function nextPic(thisid,isNext){
	// nbOfRecord=2;
	  id=thisid
	  if(isNext==1){
		starEvent=starEvent+eventnbOfRecord;
		endEvent=endEvent+eventnbOfRecord;
	}else if(isNext==0){
		starEvent=starEvent-eventnbOfRecord;
		endEvent=endEvent-eventnbOfRecord;
	}
	
	//alert('starNews='+starNews)
	//alert('endNews='+endNews)
	  writetxt('<table width=100% border=0 cellspacing=0 cellpadding=0><tr bgcolor><td  valign=top width=6><img src=images/spacer.gif height=60 width=1></td><td   valign=top align=center><img src=images/loading_ani2.gif?r=1></td><td width=1 valign=top >&nbsp;</td></tr></table>');
	loadXMLDoc('_photos.asp?starNews='+starEvent+'&endNews='+endEvent+'&nbOfRecord='+eventnbOfRecord+'&query='+query+'&photocatid='+photocatid+'&isNext='+isNext);
	//alert(query);
	disablePicNav();	
}

var xmlhttp;
function loadXMLDoc(url)
{

xmlhttp=null;
if (window.XMLHttpRequest)
  {// code for Firefox, Opera, IE7, etc.
  xmlhttp=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
if (xmlhttp!=null)
  {
	url=url+'&'+Math.random();	  
  xmlhttp.onreadystatechange=state_Change;
  xmlhttp.open("GET",url,true);
  xmlhttp.send(null);
  }
else
  {
  alert("Your browser does not support XMLHTTP.");
  }
}

function state_Change()
{
if (xmlhttp.readyState==4)
  {// 4 = "loaded"
  if (xmlhttp.status==200)
    {// 200 = "OK"
    //text=xmlhttp.responseText;
	//alert(AT.ishover+','+AT.oktomove);
	//if(AT.ishover==true && AT.oktomove==true){
	writetxt(xmlhttp.responseText);
	}
   // }getElementById - MDC
 else
    {
		alert(xmlhttp.responseText)
    alert("Problem retrieving data:" + xmlhttp.statusText);
	
    }
  }
}
function writetxt(str){
	document.getElementById(id).innerHTML=str;

}

function disablePicNav(){
	if(endEvent==eventnbOfRecord || eventCount==0 ){
		document.getElementById('PreviousEventId').innerHTML='';
		//alert('PreviousNewsId:dis')
	}	
	else{
		
		document.getElementById('PreviousEventId').innerHTML='<a href=javascript:nextPic("SlideId",0)><img src=images/previows.jpg  border=0</a>';
		//alert('PreviousNewsId:abl')
	}	
	if(endEvent >= eventCount || eventCount<eventnbOfRecord+1 ){
		document.getElementById('NextEventId').innerHTML='';	
		//alert('NextNewsId:dis')
	}	
	else{
		document.getElementById('NextEventId').innerHTML='<a href=javascript:nextPic("SlideId",1)><img src=images/next.jpg border=0</a>';
		//alert('NextNewsId:abl')
	}	
}
function onlynb(e)
{
if(window.event)
{thisKeyCode = window.event.keyCode;} // IE hack
else
{thisKeyCode = e.which;} 
	if(((thisKeyCode<48)||(thisKeyCode>57))&&(thisKeyCode!=0)&&(thisKeyCode!=8)&&(thisKeyCode!=46))
		{
		alert("Only Numbers");
			if(window.event)
			{window.event.keyCode="";} // IE hack}
			else
			{e.preventDefault(); }

		}
}

