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_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) { //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 OpenWindow(page,name,w,h,scroll)
 {
  setari = 'height='+h+',width='+w+',scrollbars='+scroll+',resizable';
  win = window.open(page,name,setari);
 }

 function changemodel(selected_model_id) {

  myArray=modelsArray;
  myForm=document.formarticle;
  var arrayLength = modelsID.length;
  var selMakeIndex = document.formarticle.make.selectedIndex;
  var selMake = document.formarticle.make.options[selMakeIndex].value;
  var modelIndex=0;
  document.formarticle.model.options.length = 0;
  for (var i=0;i<arrayLength;i++)  //For all makes
  {
    var mkSplitArray =  modelsID[i];
    if (selMake == mkSplitArray)  // For the choosen make
    {
      myForm.model.options[modelIndex] =   new Option ('...', 0);
      modelIndex++;
      for (var j=0;j<myArray[mkSplitArray].length;j++) //For all the models within
      {
        var splitArray = myArray[mkSplitArray][j].split("|");
        var modelName = splitArray[1];
        var modelId = splitArray[0];

          myForm.model.options[modelIndex] =   new Option (modelName, modelId);
          if (selected_model_id == modelId)
          {
            myForm.model.selectedIndex = modelIndex;
          }
          modelIndex++;
      } // for j
      break;
    }
  } // for i
}

var browserinfos=navigator.userAgent
var ns4=document.layers
var ns6=document.getElementById&&!document.all&&!browserinfos.match(/Opera/)
var ie=document.all&&!browserinfos.match(/Opera/)
var ie5=document.all&&document.getElementById&&!browserinfos.match(/Opera/)
var opera=browserinfos.match(/Opera/)

function RunSlideShow( imageFiles, imageUrl, imageTitle, imageText, displaySecs)
{
  var imageSeparatorFiles = imageFiles.indexOf(";");
  var nextImage = imageFiles.substring(0,imageSeparatorFiles);

  imageUrl=imageUrl.replace("&amp;","&");

  var imageSeparatorUrl = imageUrl.indexOf(";");
  var nextUrl = imageUrl.substring(0,imageSeparatorUrl);

  var imageSeparatorTitle = imageTitle.indexOf(";");
  var nextTitle = imageTitle.substring(0,imageSeparatorTitle);

  var imageSeparatorText = imageText.indexOf(";");
  var nextText = imageText.substring(0,imageSeparatorText);

  if (ie || ie5)

  {
    document.getElementById('pictureName').style.filter="blendTrans(duration=2)";
    document.getElementById('pictureName').filters.blendTrans.Apply();

  }

  document.getElementById('pictureName').src = nextImage;
  document.getElementById('pictureUrl').href = nextUrl;
  document.getElementById('pictureUrl1').href = nextUrl;
  nextText = nextText.substring(0,200);
  document.getElementById('pictureText').innerHTML = nextText;
  document.getElementById('pictureUrl1').innerHTML = nextTitle;

  if (ie || ie5)

  {
    document.getElementById('pictureName').filters.blendTrans.Play();
  }

  var futureImages= imageFiles.substring(imageSeparatorFiles+1,imageFiles.length)
    + ';' + nextImage;
  var futureUrl= imageUrl.substring(imageSeparatorUrl+1,imageUrl.length)
    + ';' + nextUrl;
  var futureTitle= imageTitle.substring(imageSeparatorTitle+1,imageTitle.length)
    + ';' + nextTitle;
  var futureText= imageText.substring(imageSeparatorText+1,imageText.length)
    + ';' + nextText;
  futureText = futureText.replace("'","`");
  futureText = futureText.replace('"',"`");        
  setTimeout("RunSlideShow('"+futureImages+"','"+futureUrl+"','"+futureTitle+"','"+futureText+"',"+displaySecs+")",
    displaySecs*1000);
}

var xmlHttp
var innerstr;

function funcget(str,email,str1,obj,val1)
{
var val = emailCheck(email);
if (!val)
{
    return false;
}	
if (val1!=''){
obj.innerHTML=val1;
}


xmlHttp=GetXmlHttpObject()
innerstr=str1;
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
} 
var url="index.php"
url=url+"?pp="+str
url=url+"&email="+email
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged ;
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 

function funcget1(str,make1,cat1,str1,obj,val1)
{

if (val1!=''){
obj.innerHTML='<font style="font-size:16px;">'+val1+'</font>';
}


xmlHttp=GetXmlHttpObject()
innerstr=str1;
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
} 
var url="index.php"
url=url+"?pp="+str
url=url+"&category="+cat1
url=url+"&make="+make1
url=url+"&sid="+Math.random();

xmlHttp.onreadystatechange=stateChanged ;
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 


function funcgetx1(str,make1,cat1,str1,obj,val1)
{

if (val1!=''){
obj.innerHTML='<font style="font-size:16px;">'+val1+'</font>';
}


xmlHttp=GetXmlHttpObject()
innerstr=str1;
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
} 
var url="index.php"
url=url+"?ppx="+str
url=url+"&category="+cat1
url=url+"&make="+make1
url=url+"&sid="+Math.random();

xmlHttp.onreadystatechange=stateChangedx ;
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 
function stateChangedx() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{ 
document.getElementById(innerstr).innerHTML=xmlHttp.responseText 
if (innerstr=='make'){
	funcget1('model',document.formarticle.input_make.value,document.formarticle.input_category.value,'input_model',document.getElementById('input_model'),'Loading...');
}
} 
} 

function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{ 
document.getElementById(innerstr).innerHTML=xmlHttp.responseText 
if (innerstr=='make'){
	funcget1('model',document.formarticle.make.value,document.formarticle.category.value,'model',document.getElementById('model'),'Loading...');
}
} 
} 

function GetXmlHttpObject()
{ 
var objXMLHttp=null
if (window.XMLHttpRequest)
{
objXMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject)
{
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}
return objXMLHttp
} 
