<!--
function MM_findObj(n, d) { //v4.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);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

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_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_openWindow(theURL,winName,launchWin,features) { //v1.0
  if (launchWin == ''){
    window.open(theURL,winName,features);
  }
  else{
    var controller = window.open(theURL,winName,features);
    if (controller.opener == null){controller.opener = self;}
    controller.opener.name = launchWin;
    controller.focus();
    return controller;
  }
}

var spath='http://www.previewcars.com/siteadmin/photos/';
var patha="/";
var picno=0;
var curpic=0;
var curpick=0;
var curpic_V=0;
var curpick_V=0;
var stop="yes";
var cells_h=12;
var cells_v=16;
var inst=0;
var isshow=0;

var bigpcomplete='yes';
var expiration = new Date();
expiration.setTime(expiration.getTime() + 432000000);
//defaultStatus='leRage.com';

if (screen.height>400) {swidth=600;sheight=400;}
                  else {swidth=450;sheight=300;}
				  
if (screen.height>600) {swidth_V=400;sheight_V=600;}
                  else {swidth_V=300;sheight_V=450;}


function readCookie(cookieName) {
  var cookieValue = null;
  var posName = document.cookie.indexOf(escape(cookieName) + '=');
  if (posName != -1) {
    var posValue = posName + (escape(cookieName) + '=').length;
    var endPos = document.cookie.indexOf(';', posValue);
    if (endPos != -1)
      cookieValue = unescape(document.cookie.substring(posValue, endPos));
    else
      cookieValue = unescape(document.cookie.substring(posValue));
  }
 return cookieValue;
}


function checkClicks() {
 lid=readCookie('previewid');

 if (lid == null) {
  lclicks=readCookie('previewclicks');

  if (lclicks<5) {
   lclicks++;
   document.cookie = "previewclicks=" + escape(lclicks)+ "; expires=" + expiration.toGMTString()+";path=" +patha
  } else {return 0;} //temporarily made 0 .... it was 1
 }
   return 0;
}


function showme(pic,k) {

 stop="yes";
 curpick=k;
 picno=curpic+k;

 pic=pic.replace('/thumbs/','/');//cm

// tmp=checkClicks();
// if (tmp>0) {document.location.href='login.php';}

 document.getElementById('bigp').src=pic;

   if (curpic+k<didpic.length) {cap=didpic[picno];}
                        else {cap='';} 

 // c=pic.indexOf("lerage.com/shows");
 c=pic.indexOf(spath);//modified by karthi

 // tmp=pic.substring(c+16,pic.length);//comment by karthik
tmp=pic.substring(c+17,pic.length);//Modifi by karthik

//var picid = tmp.substring(tmp.indexOf("/")+1,tmp.length);//Add by karthik
//var picid = picid.substring(picid.indexOf("/")+1,picid.length);//Add by karthik
//var picid = picid.substring(picid.indexOf("/")+1,picid.length);//Add by karthik
//var picid = picid.substring(picid.indexOf("/")+1,picid.length);//Add by karthik
//var picid = picid.replace(".jpg","");//Add by karthik
 var ssplit = pic.split("/");
  var ssplitlen = (ssplit.length)
 stxt=(ssplit[ssplitlen-1]);
 picid=stxt.replace(".jpg","");

// if (previewfv.indexOf(tmp)<0) {document.getElementById('idpic').innerText='Image ID : '+cap;}//comment by karthik
 //                    else {document.getElementById('idpic').innerText='Image ID : '+cap +' *';} //comment by karthik

  if(dshow[picno]!="" && (typeof dshow[picno] != 'undefined'))
  {
  document.getElementById('idshow').innerText='Show :'+dshow[picno];
  }
  else
  {
   document.getElementById('idshow').innerText="";
  }

	if(isshow==1){
		 if(dman[picno]!="" && (typeof dman[picno] != 'undefined')){
		document.getElementById('manname').innerText=dman[picno];
		document.getElementById('modname').innerText=dmod[picno];
		}else
		{
		document.getElementById('manname').innerText="";
		document.getElementById('modname').innerText="";
		}
	}
 if (previewfv.indexOf(tmp)<0) {document.getElementById('idpic').innerText='Image ID : '+picid; } //Modify  by karthik
                     else {document.getElementById('idpic').innerText='Image ID : '+picid +' * ' ;} //Modify by karthik

 if (typeof diddes != 'undefined') {
   if (curpic+k<didpic.length) {cap=didshow[picno]+' / '+diddes[picno];}
                          else {cap='';}
  document.getElementById('myfvcap').innerText=cap;
 
   document.getElementById('hidevertical').style.display='list-item';
 }
} 


function selpg(page) {
 curpic=cells_h*(page-1);
 move(0);
}

function move(dir) {
 curpic=curpic+dir;
 if (curpic<0) {curpic=0;}
 if (curpic>=dpic.length) {curpic=curpic-dir;}

 for(i=0;i<cells_h;i++) {
  tmp="pic"+i;
//  newpic='/images/spacer.gif';
   newpic=spath+'/spacer.gif'; //modified by karthi
  document.getElementById(tmp).src=newpic;
 }

 for(i=0;i<cells_h;i++) {
   tmp="pic"+i;
   if ((curpic+i)>=dpic.length) {newpic=spath+'/spacer.gif';}
                           else {newpic=spath+dpic[curpic+i];}
   document.getElementById(tmp).src=newpic;
 }  

 document.getElementById('pgnum').innerText=Math.ceil(1+curpic/cells_h);
} 


function slide(pcno) {

  if (pcno<0) {stop="yes";}
 if (pcno==0) {stop="no";}


 if (inst==0) {bigpcomplete='yes';inst=1;slideshow();}
}


function slideshow() {
if (document.images) {


 if(typeof dpic[picno] !="undefined") { //added
 if (stop=="no") { 

   curpick=(picno % cells_h);
  
    if (bigpcomplete=='yes') {
     bigpcomplete='no';
	 
	
    if (previewfv.indexOf(dpic[picno])<0) {cap='Image ID : '+didpic[picno];} //comment by karhtik
                                     else {cap='Image ID : '+didpic[picno] +' *';} //comment by karthik
									 
	var picid = dpic[picno].substring(dpic[picno].indexOf("/")+1,dpic[picno].length);//Add by karthik
	var picid = picid.substring(picid.indexOf("/")+1,picid.length);//Add by karthik
	var picid = picid.substring(picid.indexOf("/")+1,picid.length);//Add by karthik
	var picid = picid.replace(".jpg","");//Add by karthik
	
	
	if (previewfv.indexOf(dpic[picno])<0) {cap='Image ID : '+picid;} //Modify by karthik
                                    else {cap='Image ID : '+picid +' * ';} //Modify by karthik
		
    document.getElementById('idpic').innerText=cap;
	 
  if(dshow[picno]!="" && (typeof dshow[picno] != 'undefined'))
  {
  document.getElementById('idshow').innerText='Show :'+dshow[picno];
  }
  else
  {
   document.getElementById('idshow').innerText="";
  }

	if(isshow==1){
		 if(dman[picno]!="" && (typeof dman[picno] != 'undefined')){
		document.getElementById('manname').innerText=dman[picno];
		document.getElementById('modname').innerText=dmod[picno];
		}else
		{
		document.getElementById('manname').innerText="";
		document.getElementById('modname').innerText="";
		}
	}
	//alert(dpic.length);
    picno++;
	
	
    setTimeout("slidenext()",2500);

   } else {setTimeout("slideshow()",500);}

  
 } else {inst=0;}
}//added//
else{inst=0;} //added
}



}


function slidenext() {
 if (picno<dpic.length) {
  document.getElementById('idpic').innerText='Loading Image ...';
  dpic[picno]=dpic[picno].replace('thumbs/','');//cm
  document.getElementById('bigp').src=spath+dpic[picno];
  if (typeof numpic != 'undefined') {document.getElementById('numpic').innerText='Image '+eval(picno+1)+' / '+didpic.length;}

 } else {stop='yes';}

 slideshow();
}

///////////////////////////////End HORIZONTAL IMAGE FUNCTIONALITIES //////////////////////

///////////////////////////////Start VERTICAL IMAGE FUNCTIONALITIES //////////////////////
function showme_V(pic,k) {
 stop="yes";
 curpick_V=k;
 picno=curpic_V+k;

  pic=pic.replace('/thumbs/','/');//cm

// tmp_V=checkClicks();
// if (tmp_V>0) {document.location.href='login.php';}

 document.getElementById('bigp_V').src=pic;

 
   if (curpic_V+k<didpic_V.length) {cap=didpic_V[picno];}
                        else {cap='';} 

 // c=pic.indexOf("lerage.com/shows");
 c=pic.indexOf(spath);//modified by karthi

 // tmp=pic.substring(c+16,pic.length);//comment by karthik
 tmp_V=pic.substring(c+17,pic.length);//Modifi by karthik
/*
var picid = tmp_V.substring(tmp_V.indexOf("/")+1,tmp_V.length);//Add by karthik
var picid = picid.substring(picid.indexOf("/")+1,picid.length);//Add by karthik
var picid = picid.substring(picid.indexOf("/")+1,picid.length);//Add by karthik
var picid = picid.substring(picid.indexOf("/")+1,picid.length);//Add by karthik
var picid = picid.replace(".jpg","");//Add by karthik

// if (previewfv.indexOf(tmp)<0) {document.getElementById('idpic').innerText='Image ID : '+cap;}//comment by karthik
 //                    else {document.getElementById('idpic').innerText='Image ID : '+cap +' *';} //comment by karthik
  */
 var ssplit = pic.split("/");
  var ssplitlen = (ssplit.length)
 stxt=(ssplit[ssplitlen-1]);
 picid=stxt.replace(".jpg","");
 
 if (previewfv.indexOf(tmp_V)<0) {document.getElementById('idpic_V').innerText='Image ID : '+picid; } //Modify  by karthik
                     else {document.getElementById('idpic_V').innerText='Image ID : '+picid +' * ' ;} //Modify by karthik
	if(isshow==1){
		 if(dman_V[picno]!="" && (typeof dman_V[picno] != 'undefined')){
		document.getElementById('manname_V').innerText=dman_V[picno];
		document.getElementById('modname_V').innerText=dmod_V[picno];
		}else
		{
		document.getElementById('manname_V').innerText="";
		document.getElementById('modname_V').innerText="";
		}
	}
  if(dshow_V[picno]!="" && (typeof dshow_V[picno] != 'undefined')){
  document.getElementById('idshow_V').innerHTML='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Show :'+dshow_V[picno];
  }
  else
  {
   document.getElementById('idshow_V').innerText="";
  }
  
  
 if (typeof diddes_V != 'undefined') {
   if (curpic_V+k<didpic_V.length) {cap=didshow_V[picno]+' / '+diddes_V[picno];}
                          else {cap='';}
  document.getElementById('myfvcap_V').innerText=cap;
  
  
  document.getElementById('hidevertical').style.display='list-item';

 }
} 

function move_V(dir) {

 curpic_V=curpic_V+dir;
 if (curpic_V<0) {curpic_V=0;}
 if (curpic_V>=dpic_V.length) {curpic_V=curpic_V-dir;}

 for(i=0;i<cells_v;i++) {
  tmp_V="pic_V"+i;

//  newpic='/images/spacer.gif';
   newpic=spath+'spacer.gif'; //modified by karthi
   
  document.getElementById(tmp_V).src=newpic;
 }

 for(i=0;i<cells_v;i++) {
   tmp_V="pic_V"+i;
  
   if ((curpic_V+i)>=dpic_V.length) {newpic=spath+'spacer.gif';}
                           else {newpic=spath+dpic_V[curpic_V+i];}
   document.getElementById(tmp_V).src=newpic;
 }  

 document.getElementById('pgnum_V').innerText=Math.ceil(1+curpic_V/cells_v);
} 


function selpg_V(page) {
 curpic_V=cells_v*(page-1);
 move_V(0);
}

function slide_V(pcno) {

  if (pcno<0) {stop="yes";}
 if (pcno==0) {stop="no";}


 if (inst==0) {bigpcomplete_V='yes';inst=1;slideshow_V();}
}
function slideshow_V() {
if (document.images) {


 if(typeof dpic_V[picno] !="undefined") { //added
 if (stop=="no") { 

   curpick_V=(picno % cells_v);
  
    if (bigpcomplete_V=='yes') {
     bigpcomplete_V='no';
	 
	
    if (previewfv.indexOf(dpic_V[picno])<0) {cap='Image ID : '+didpic_V[picno];} //comment by karhtik
                                     else {cap='Image ID : '+didpic_V[picno] +' *';} //comment by karthik
									 
	var picid = dpic_V[picno].substring(dpic_V[picno].indexOf("/")+1,dpic_V[picno].length);//Add by karthik
	var picid = picid.substring(picid.indexOf("/")+1,picid.length);//Add by karthik
	var picid = picid.substring(picid.indexOf("/")+1,picid.length);//Add by karthik
	var picid = picid.replace(".jpg","");//Add by karthik
	
	
	if (previewfv.indexOf(dpic_V[picno])<0) {cap='Image ID : '+picid;} //Modify by karthik
                                    else {cap='Image ID : '+picid +' * ';} //Modify by karthik
		
    document.getElementById('idpic_V').innerText=cap;
	
	if(isshow==1){
		 if(dman_V[picno]!="" && (typeof dman_V[picno] != 'undefined')){
		document.getElementById('manname_V').innerText=dman_V[picno];
		document.getElementById('modname_V').innerText=dmod_V[picno];
		}else
		{
		document.getElementById('manname_V').innerText="";
		document.getElementById('modname_V').innerText="";
		}
	}
  if(dshow_V[picno]!="" && (typeof dshow_V[picno] != 'undefined')){
  document.getElementById('idshow_V').innerHTML='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Show :'+dshow_V[picno];
  }
  else
  {
   document.getElementById('idshow_V').innerText="";
  }
	//alert(document.getElementById('hidevertical').style.display);
	//alert(dpic.length);
    picno++;
	

    setTimeout("slidenext_V()",2500);

   } else {setTimeout("slideshow_V()",500);}

  
 } else {inst=0;}
}//added//
else{inst=0;} //added
}
}

function slidenext_V() {
 if (picno<dpic_V.length) {
  document.getElementById('idpic_V').innerText='Loading Image ...';
  dpic_V[picno]=dpic_V[picno].replace('thumbs/','');//cm
  document.getElementById('bigp_V').src=spath+dpic_V[picno];
  if (typeof numpic != 'undefined') {document.getElementById('numpic_V').innerText='Image '+eval(picno+1)+' / '+didpic_V.length;}

 } else {stop='yes';}

 slideshow_V();
}
///////////////////////////////END VERTICAL IMAGE FUNCTIONALITIES //////////////////////
function setfav(fav,favtype) {
// var c=fav.indexOf("lerage.com/shows");
//alert(fav)
//alert(favtype);
  var c=fav.indexOf(spath);//modified by karthi

// fav=fav.substring(c+16,fav.length);// for site
  fav=fav.substring(c+17,fav.length);
  //alert(fav);
 var csplit = fav.split("/");
  var splitlen = (csplit.length-2)
 // alert(csplit.length);
 fav=csplit[splitlen]+"/"+csplit[splitlen+1];
// alert(fav);
 
 if (previewfv.indexOf(fav)<0) {
  if (previewfv.length>0) {previewfv+="|"+fav;}
                    else {previewfv+=fav;}
					
  document.cookie = "lefv=" + escape(previewfv)+ "; expires=" + expiration.toGMTString()+";path=" +patha
  
  if(favtype=='H')
  document.getElementById('idpic').innerText=document.getElementById('idpic').innerText + ' *';
  
   if(favtype=='V')
  document.getElementById('idpic_V').innerText=document.getElementById('idpic_V').innerText + ' *';
  
 
 } 
}

function delfav(fav,favtype) {
	// var c=fav.indexOf("lerage.com/shows");
	//alert(dpic);
	//alert(didpic);
if(fav.indexOf('spacer.gif')=='-1'){
	  var c=fav.indexOf(spath);//modified by karthi
	 //fav=fav.substring(c+16,fav.length);//for site
	  fav=fav.substring(c+17,fav.length);
	 
	
	 if (previewfv.indexOf(fav+'|')>-1) {fav=fav+'|';}
	 else if (previewfv.indexOf('|'+fav)>-1) {fav='|'+fav;}
	
	 previewfv=previewfv.replace(fav,'');
	document.cookie = "lefv=" + escape(previewfv)+ "; expires=" + expiration.toGMTString()+";path=" +patha
	if(favtype=='H')
	{
		 for(i=(curpic+curpick);i<(dpic.length-1);i++) {
		  dpic[i]=dpic[i+1];
		//  didshow[i]=didshow[i+1];//comment by karthi
		// diddes[i]=diddes[i+1];//comment by karthi
		  didpic[i]=didpic[i+1];
		 }
	
		 dpic.length--;
		// didshow.length--; //comment by karthi
		// diddes.length--;  //comment by karthi
		 didpic.length--;
	
		 for(i=curpick;i<cells_h;i++) {
		   tmp="pic"+i;
		   if ((curpic+i)>=dpic.length) {newpic=spath+'spacer.gif';}
								   else {newpic=spath+dpic[curpic+i];}
		   document.getElementById(tmp).src=newpic;
		 }
	
		 tmp=curpic+curpick;
		if (typeof dpic[tmp]=='undefined')
		{
			showme(spath+'spacer.gif',curpick);
		}
		else
		{
			showme(spath+dpic[tmp],curpick);
		}
	}
	
	if(favtype=='V')
	{
		 for(i=(curpic_V+curpick_V);i<(dpic_V.length-1);i++) {
		  dpic_V[i]=dpic_V[i+1];
		//  didshow[i]=didshow[i+1];//comment by karthi
		// diddes[i]=diddes[i+1];//comment by karthi
		  didpic_V[i]=didpic_V[i+1];
		 }
	
		 dpic_V.length--;
		// didshow.length--; //comment by karthi
		// diddes.length--;  //comment by karthi
		 didpic_V.length--;
	
		 for(i=curpick_V;i<cells_v;i++) {
		   tmp_V="pic_V"+i;
		   if ((curpic_V+i)>=dpic_V.length) {newpic=spath+'spacer.gif';}
								   else {newpic=spath+dpic_V[curpic_V+i];}
		   document.getElementById(tmp_V).src=newpic;
		 }
	
	 	tmp_V=curpic_V+curpick_V;
		if (typeof dpic_V[tmp_V]=='undefined')
		{
			showme_V(spath+'spacer.gif',curpick_V);
		}
		else
		{
			showme_V(spath+dpic_V[tmp_V],curpick_V);
		}
	
	}
	
}
else
{
alert('No Favorites To Delete');
}
}

var message="© 1999-2003 123jump.com, Inc. All rights reserved.";

///////////////////////////////////
function clickIE4(){
 if (event.button==2){
  //alert(message);
  //return false;
 }
}

function clickNS4(e){
 if (document.layers||document.getElementById&&!document.all) {
  if (e.which==2||e.which==3){
   //alert(message);
   //return false;
  }
 }
}

if (document.layers){
 document.captureEvents(Event.MOUSEDOWN);
 document.onmousedown=clickNS4;
} else if (document.all&&!document.getElementById){
  document.onmousedown=clickIE4;
}

//document.oncontextmenu=new Function("alert(message);return false")
//-->
