var articlebyyear=false, helpPage="help", dealerAr =[], edgpress = [], edgarticle = [];
var bgc = "000000", slideAr =[], dur = 4, blend_speed = 2, crossFadeDuration =2, photos=[], ct=0, imgct=1, timer, running=false;
var splash = [], splashes = [], sct=0, simgct=1;
var slidedir, captionx, captiony, captionw;

function pagePreload()
{
 doArrow();
 showCap(0);
 if (document.images && document.SlideShow && slideAr.length>0)
  {
  showSlide();
  }

 }

function newDealer(l,p,src)
{
this.l=l;
this.p=p;
this.src=src;
}

function addDealer(l,p,src)
{
dealerAr[dealerAr.length]= new newDealer(l,p,src);
}

function loginDealer()
{
for (i=0;i<dealerAr.length;i++)
 {
 if (dealerAr[i].l==document.dealer.l.value)
   {
   if (dealerAr[i].p==document.dealer.p.value)
     {
	 parent.frames[0].dealerlogo.src=dealerAr[i].src;
	 return true;
     break;
	 }
	 else
	 {
	 alert('Unauthorized login attempt');
     parent.location="/home/splash.shtm";
	 return false;
	 break;
	 }
   }
 }
 	 alert('Unauthorized login attempt');
     parent.location="/home/splash.shtm";
	 return false;
}



function pressYear(pressyear)
{
if(arguments.length==0)
 {
 pressyear = '2009';
 }
for (i=0;i<edgpress.length;i++)
 {
 if(edgpress[i].pname.substr(edgpress[i].pname.indexOf('/press')+6,4)==pressyear)
  {
  window.location=edgpress[i].pname;
  break;
  }
 }
}

function articleYear(articleyear)
{
if(arguments.length==0)
 {
 articleyear = '2000';
 }
for (i=0;i<edgarticle.length;i++)
 {
 if(edgarticle[i].aname.substr(edgarticle[i].aname.indexOf('article')+7,4)==articleyear&&edgarticle[i].aname.indexOf("http")==-1)
  { 
  window.location=edgarticle[i].aname;
  break;
  }
 }
}

function newPress(pname,pdate,ptitle)
{
 this.pname = pname;
 this.pdate = pdate;
 this.ptitle = ptitle;
}

function newArticle(aname,atitle,asourcelink,asource,aissue,abyline)
{
 this.aname = aname;
 this.atitle = atitle;
 this.asourcelink = asourcelink;
 this.asource = asource;
 this.aissue = aissue;
 this.abyline = abyline;
}

function addPress(pname,pdate,ptitle)
{
 if (pname)
   {
   edgpress[edgpress.length] = new newPress(pname,pdate,ptitle);
   }
}

function addArticle(aname,atitle,asourcelink,asource,aissue,abyline)
{
 if (aname)
   {
   edgarticle[edgarticle.length] = new newArticle(aname,atitle,asourcelink,asource,aissue,abyline);
   }
}

function pressContents()
{
 var edgyear=new String(window.location);
 edgyear = edgyear.substr(edgyear.indexOf('/press')+6,4);
 for(i=0;i<edgpress.length;i++)
 {
 var writepress = new String('\<font class="contents_happenings"\>'+edgpress[i].pdate+'\<br\>\</font\>\<a href="'+edgpress[i].pname+'" class="small"\>'+edgpress[i].ptitle+'\</a\>\<br\>\<br\>');
 if(edgpress[i].pname.substr(edgpress[i].pname.indexOf('/press')+6,4)==edgyear)document.write(writepress);
 }
}

function articleContents()
{
 var edgyear=new String(window.location);
 if(edgyear.indexOf('article')==-1)edgyear="";
 edgyear = edgyear.substr(edgyear.indexOf('article')+7,4);

 for(i=0;i<edgarticle.length;i++)
 {
 var writearticle = new String('\<a href="');
 if (edgarticle[i].aname.indexOf('http')!=-1)
  {
  writearticle+='javascript:popUp(\''+edgarticle[i].aname.substring(11,edgarticle[i].aname.length)+'\')';
  }
  else
  {
  writearticle+=edgarticle[i].aname;
  }
 writearticle+='" class="contents_happenings"\>'+edgarticle[i].atitle+'\</A\>\<br\>';;
 if (edgarticle[i].asource!="")writearticle+='\<font class="title-box-middle"\>';
 if (edgarticle[i].asourcelink!="")writearticle+='\<a href="javascript:popUp(\''+edgarticle[i].asourcelink+'\')" class="small"\>';
 if (edgarticle[i].asource!="")writearticle+=edgarticle[i].asource;
 if (edgarticle[i].asourcelink!="")writearticle+='\</A\>';
 if (edgarticle[i].asource!="")writearticle+='\</font\>';
 if (edgarticle[i].aissue!="")writearticle+='\<br\>'+edgarticle[i].aissue;
 if (edgarticle[i].abyline!="")writearticle+='\<br\>'+edgarticle[i].abyline;
 writearticle+='\<br\>\<br\>';
 if(edgyear!=""||edgarticle[i].aname.substr(edgarticle[i].aname.indexOf('article')+7,4)==edgyear)document.write(writearticle);
 }
}

function doArrow()
{
 var arrow=new String(window.location);
 if((i=arrow.indexOf('edg_'))!=-1&&document.images)
  {
  var arrow = new String('document.'+arrow.substr(i,9));


  if(document.edg_se_pi)
   {
   arrow+='.src="img/arrowindicator.gif"';
   eval(arrow);
   }
  }

}
var abbr = [];
function newabbr(abr, lon, cap)
{
 this.abr = abr;
 this.lon = lon;
 this.cap = cap;
}
function addabbr(abr, lon, cap)
{
 if (abr)
   {
   abbr[abbr.length] = new newabbr(abr, lon, cap);
   }
}
addabbr('se','sports &amp; event','SPORTS &amp; EVENT');
addabbr('pw','portrait &amp; wedding','PORTRAIT &amp; WEDDING');
addabbr('sg','school &amp; group','SCHOOL &amp; GROUP');
addabbr('at','attraction','ATTRACTION');
addabbr('pm','photo mall','PHOTOMALL');
addabbr('pr','photoreflect publisher','PHOTOREFLECT PUBLISHER');
addabbr('ls','labtricity server','LABTRICITY SERVER');
addabbr('lc','labtricity client','LABTRICITY CLIENT');
addabbr('pp','package &amp; print','PACKAGE &amp; PRINT');
addabbr('dr','darkroom','DARKROOM');
addabbr('tc','contents','CONTENTS');
addabbr('pi','product information','PRODUCT INFORMATION');
addabbr('qs','quick start','QUICK START');
addabbr('up','updates/upgrades','UPDATES/UPGRADES');
addabbr('ma','manuals','MANUALS');
addabbr('he','help','HELP');
addabbr('ts','troubleshooting','TROUBLESHOOTING');
addabbr('fa','faq','FAQ');

function doPath()
{
 var path=new String(window.location);
 if((i=path.indexOf('edg_'))!=-1&&document.images)
  {
  var pathplus = new String(path.substring(i+9,path.indexOf('.shtm')));
  path = new String(path.substr(i,9));

  for(j=0;j<abbr.length;j++)
   {
   if (abbr[j].abr==path.substr(4,2))break;
   }
   var wpath = new String('&gt; \<a href="'+path.substr(0,7)+'tc.shtm" class="contents"\>'+abbr[j].lon+'\</a\> &gt; \<a href="')
   for(k=0;k<abbr.length;k++)
   {
   if (abbr[k].abr==path.substr(7,2))break;
   }
  wpath+=path+'.shtm" class="contents"\>'+abbr[k].lon+'\</a>';
  if(pathplus!="")
   {
   wpath+=' &gt;\<font class="tolc"\>';
   for(l=0;l<pathplus.length;l++)
    {
	if (pathplus.substr(l,1)=='_')
	 {
	 wpath+=' ';
	 }
	 else
	 {
	 wpath+=pathplus.substr(l,1);
	 }
	}
	wpath+='\</font\>';
   }
  document.write(wpath);
  }
}

function doTitle()
{
 var path=new String(window.location);
 if(path.indexOf('byproduct')!=-1)
 {
// document.write('SUPPORT INFORMATION BY PRODUCT');
 }
 else
 {
 if((i=path.indexOf('edg_'))!=-1&&document.images)
  {
  var pathplus = new String(path.substring(i+9,path.indexOf('.shtm')));
  path = new String(path.substr(i,9));

  for(j=0;j<abbr.length;j++)
   {
   if (abbr[j].abr==path.substr(4,2))break;
   }
   var wpath = new String(abbr[j].cap+' ')
   for(k=0;k<abbr.length;k++)
   {
   if (abbr[k].abr==path.substr(7,2))break;
   }
  wpath+=abbr[k].cap;
  if(pathplus!="")
   {
   wpath+=':\<font class="touc"\>';
   for(l=0;l<pathplus.length;l++)
    {
	if (pathplus.substr(l,1)=='_')
	 {
	 wpath+=' ';
	 }
	 else
	 {
	 wpath+=pathplus.substr(l,1);
	 }
	}
	wpath+='\</font\>';
   }
  document.write(wpath);
  }
  
 }
}

function showCap(Cap)
{
if(captionw!=null&&captionx!=null&&captiony!=null)
  {
  for (i=0;i<slideAr.length;i++)
   {
   MM_showHideLayers("Cap"+i,'','hide')
   }
  MM_showHideLayers("Cap"+Cap,'','show')
  }
}

function wCaps()
{ 
if(captionw!=null&&captionx!=null&&captiony!=null)
  {
  var vApp = navigator.appVersion, lHeight=32, lWidth=captionw, lTop=captiony, lLeft = captionx;
  if (vApp.indexOf('Macintosh')!=-1)lHeight = lHeight*.6875;
  for (i=0;i<slideAr.length;i++)
   {
      var wLayer = new String('\<div class="small" id="Cap'+new String(i)+'" style="position:absolute; width:'+new String(lWidth)+'px; height:'+new String(lHeight)+'px; z-index:4; left: '+new String(lLeft)+'px; top: '+new String(lTop)+'px; visibility: hidden"\>\<CENTER\>\<font class="slideshow"\>'+slideAr[i].nam+'\</font\>\</CENTER\>\</div\>');
      document.write(wLayer);
   }
  }
}

function loadslide(src, zoo, nam)
{
 this.src = src;
 this.zoo = zoo;
 this.nam = nam;
}

function SlideShow(sid, nam, sdm)
{
 if (sid)
   {
   if (sid.substring(0,sid.indexOf('/'))==slidedir||slidedir=='')
     {
	 var zoo=sdm; 
     slideAr[slideAr.length] = new loadslide('slides/'+sid+'.jpg',zoo,nam);
	 }
   }
}

function ZoomPhoto(url)
{
if(slideAr.length>0)
   {
   popUp(url);
   }
}

function slideStep(step)
{
if(document.SlideShow)
 {
  if(step==0)
   {
   if(running)
    {
	slideStepSwitch(0);
	}
	else 
    {
	if(document.slidepause)document.slidepause.src = '/common/img/slidepauselit.gif';
    timer = setTimeout('showSlide()',dur*500);
    }
   }
   else
   {
   if (running)
     {
	 slideStepSwitch(0);
	 slideStepSwitch(step);
	 if(step>0)slideStepSwitch(step);
	 }
   slideStepSwitch(step);
   }
  }
}

function slideStepSwitch(step)
{
 if(document.SlideShow && slideAr.length>0)
  {
  timer=clearTimeout(timer);
  if (running)
   {
   if (ct+step<0)ct=slideAr.length;
   ct=(ct+step);
   running=false;
   if(document.slidepause)document.slidepause.src = '/common/img/slidepausered.gif';
   }
  if(step!=0)
    {
	if (ct==1 && photos.lenght==2 && step==1)ct++;
    if (ct+step<0)ct=slideAr.length;
    ct=(ct+step);
    if (ct>slideAr.length-1) ct=0;
    showCap(ct);
    if (! photos[ct])
     {
      photos[ct] = new Image;
      photos[ct].src = slideAr[ct].src;
     }
     document.SlideShow.src = slideAr[ct].src;
     if(document.anchors[0])
     {
     document.anchors[0].href = slideAr[ct].zoo;
     }
    if (document.images && ! running)
     {
     timer = setTimeout('showSlide()',dur*1000);
     }
   }
  }
}

function showSplash()
 {
 if(document.splashimg && splash.length>0)
 {
  if (sct<0)sct=splash.length;
  if (sct>splash.length-1) sct=0;
  if (document.all)
    {
    document.splashimg.style.filter="blendTrans(duration=blend_speed)";
    document.splashimg.style.filter="blendTrans(duration=crossFadeDuration)";
    document.splashimg.filters.blendTrans.Apply() ;  
    }
  if (splashes[sct] && (splashes[sct].complete || splashes[sct].complete==null))
    {
    document.splashimg.src = splashes[sct].src;
    if (document.all)
      {
      document.splashimg.filters.blendTrans.Play();
      }
    }
    if(sct==0) sct=splash.length;
    if(sct==splash.length) sct=0;
    if (++sct>splash.length-1) sct=0;
    splashes[sct] = new Image;
    splashes[sct].src = splash[sct].src;
    timer = setTimeout('showSplash()',dur*1000);
 }
}

function slideSet(sno)
{

 if(document.SlideShow && slideAr.length>0)
 {
 if(slidedir=='lo')
  {

    max = slideAr.length;
    var sno=Number.NaN;
    while (isNaN(sno)) 
    {
      sno=Math.floor(Math.random()*(max))+1;
    }
  }
  
  timer=clearTimeout(timer);
  running=false;
  if(document.slidepause)document.slidepause.src = '/common/img/slidepausered.gif';
  ct = sno-1;
    showCap(ct);
    if (! photos[ct])
     {
      photos[ct] = new Image;
      photos[ct].src = slideAr[ct].src;
     }
     document.SlideShow.src = slideAr[ct].src;
     if(document.anchors[0])
     {
     document.anchors[0].href = slideAr[ct].zoo;
     }
     if (document.images && ! running)
     {
     timer = setTimeout('showSlide()',dur*1000);
     }
	}
}


function showSlide()
 {
 if(document.SlideShow && slideAr.length>0)
 {
  if (ct<0)ct=slideAr.length;
  if (ct>slideAr.length-1) ct=0;
  showCap(ct);
  if (document.all)
    {
    document.SlideShow.style.filter="blendTrans(duration=blend_speed)";
    document.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";
    document.SlideShow.filters.blendTrans.Apply() ;  
    }
  if (photos[ct] && (photos[ct].complete || photos[ct].complete==null))
    {
	// seems to not happen
    document.SlideShow.src = photos[ct].src;
    if (document.all)
      {
      document.SlideShow.filters.blendTrans.Play();
      }
	 if(document.anchors[0])
     {
	
     document.anchors[0].href = slideAr[ct].zoo;
 	}
    running=true;
	if(document.slidepause)document.slidepause.src = '/common/img/slidepauselit.gif';
    }
    if(ct==0) ct=slideAr.length;
    if(ct==slideAr.length) ct=0;
    if (++ct>slideAr.length-1) ct=0;
    photos[ct] = new Image;
    photos[ct].src = slideAr[ct].src;
    timer = setTimeout('showSlide()',dur*1000);
 }
}

function popHelp(helpPage)
{
    var helpString="window.open(\'/common/"+helpPage+".htm\',\'HelpWindow\',\'status,scrollbars,resizable,width=400,height=400\')";
    eval(helpString);
}

function popUp(newURL,style)
{
    var popupwindow;
	if (!style)popupwindow = window.open(newURL,null,'height=300,width=800,top=50,left=50,status=yes,toolbar=yes,menubar=yes,resizable=yes,location=yes,scrollbars=yes,titlebar=yes');
	if (style==1)popupwindow = window.open(newURL,null,'height=498,width=600,top=50,left=50,status=no,toolbar=no,menubar=no,resizable=yes,location=no,scrollbars=no,titlebar=no');
	if (style==2)popupwindow = window.open(newURL,null,'height=600,width=800,top=50,left=50,status=no,toolbar=no,menubar=no,resizable=yes,location=no,scrollbars=yes,titlebar=no,personalbar=no');
	if (style==3)popupwindow = window.open(newURL,null,'height=600,width=307,top=50,left=50,status=no,toolbar=no,menubar=no,resizable=yes,location=no,scrollbars=yes,titlebar=no,personalbar=no');
	if (style==4)popupwindow = window.open(newURL,null,'height=400,width=350,top=50,left=50,status=no,toolbar=no,menubar=no,resizable=yes,location=no,scrollbars=yes,titlebar=no,personalbar=no');
	popupwindow.focus();
}

function popDownload(newURL)
{
    var popupwindow;
	newURL='/asp/tbyb/tbyb.asp?d='+newURL;
    nowGo = window.open(newURL,null,'height=600,width=418,top=50,left=50,status=no,toolbar=no,menubar=no,resizable=yes,location=no,scrollbars=yes,titlebar=no,personalbar=no');
	nowGo.focus();
}

function tbybDR(parts,newURL)
{
if(parts=='3')
 {
 document.location.href='/asp/tbyb/tbybdr.asp?d='+newURL;
 }
 else
 {
 document.location.href='/asp/tbyb/tbyb.asp?d='+newURL;
 }
}

function popDownloadDR(newURL)
{
    var popupwindow;
		newURL='/asp/tbyb/tbybdr.asp?d=dr/ver8_5/DRWeb(Full)/DRWebFull.exe';
    nowGo = window.open(newURL,null,'height=600,width=418,top=50,left=50,status=no,toolbar=no,menubar=no,resizable=yes,location=no,scrollbars=yes,titlebar=no,personalbar=no');
		nowGo.focus();
}

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.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_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 tmt_findObj(n){
	var x,t; if((n.indexOf("?"))>0&&parent.frames.length){t=n.split("?");
	x=eval("parent.frames['"+t[1]+"'].document.getElementById('"+t[0]+"')");
	}else{x=document.getElementById(n)}return x;
}

function MM_showHideLayers() { //v3.0A Modified by Al Sparber and Massimo Foti for NN6 Compatibility

  var i,p,v,obj,args=MM_showHideLayers.arguments;if(document.getElementById){
   for (i=0; i<(args.length-2); i+=3){ obj=tmt_findObj(args[i]);v=args[i+2];
   v=(v=='show')?'visible':(v='hide')?'hidden':v;
   if(obj)obj.style.visibility=v;}} else{
  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; }
    obj.visibility=v; }}
}




