//.. eZeeGallery NoTheme
//.. Copyright 2005 4LevelWebs All rights Reserved 
//.. version: 1.0.0 * DW4/MXSeries/DW8 *  08/24/2005
//.. Asset(ezeegallery.js)

var LvlTitle1="";
function setTitle(title){
 if(document.getElementById("gallerytitle")){
   document.getElementById("gallerytitle").innerHTML=eval(title);
   }
}
LvLLeft = new Image();
LvLLeft.src = "/product/ezeegallery/demos/notheme/images/arrowleft.gif";
LvLRight = new Image();
LvLRight.src = "/product/ezeegallery/demos/notheme/images/arrowright.gif";
var LvL_Sid1=null;
var LvL_Sid2=null;
function LvL_chClass(id, nc){
 if(document.getElementById){if(document.getElementById(id)){if(LvL_Sid1!=id){
 LvLel1=document.getElementById(id);LvLel1.className=nc;}}}
}
function LvL_dnClass(id,oc,nc){
 if(document.getElementById){if(document.getElementById(id)){
 if(LvL_Sid1!=null){if(document.getElementById(LvL_Sid1)){ 
 document.getElementById(LvL_Sid1).className=oc;}}
 LvLel1=document.getElementById(id);LvLel1.className=nc;LvL_Sid1=id;}}
}
function LvL_chClass2(id, nc){
 if(document.getElementById){if(document.getElementById(id)){
 if(LvL_Sid2!=id){LvLel2=document.getElementById(id);LvLel2.className=nc;}}}
}
function LvL_dnClass2(id,oc,nc){
 if(document.getElementById){if(document.getElementById(id)){
 if(LvL_Sid2!=null){if(document.getElementById(LvL_Sid2)){ 
 document.getElementById(LvL_Sid2).className=oc;}}
 LvLel2=document.getElementById(id);LvLel2.className=nc;LvL_Sid2=id;}}
}
function setFirstLink(){
 if(document.getElementById("fullimage")){
  if(document.getElementById("fullimage").innerHTML.indexOf(Fi)>1){
  LvL_dnClass2('link1','linksNorm','linksDown');LvL_Sid2="link1";
  LvL_dnClass('img1','thumbNorm','thumbDown');LvL_Sid1="img1";
  }
 }
}
var setInit=false;
function setImage(image){
 var imgDiv=document.getElementById("fullimage");
 if(imgDiv){
  imgDiv.innerHTML=image;
  toggleVisTimer();
  }
}
function closeFullImage(){
 var imgDiv=document.getElementById("fullimage");
   imgDiv.style.top=-1000+"px";
}
var LvLTrans = 0;
function applyTransition(oImg){
 if(document.all && LvLTrans == 1 && !window.opera){
  var mg = document.getElementById(oImg);
    mg.style.visibility = "hidden";
    mg.filters(0).Apply();
    mg.style.visibility = "visible";
    mg.filters(0).Play(0.3);
	}
}
function Lvl_showCaption(id){
  var captionDiv=document.getElementById("caption");
 if(captionDiv){
  if(!eval(id)==""){
    captionDiv.style.display="block";
    captionDiv.innerHTML="<p>"+unescape(eval(id))+"</p>";
  }else{
    captionDiv.innerHTML="";
    captionDiv.style.display="none";
  }
 }
}
var LvLTimer1=null;
var LvLTimer2=null;
function toggleVisTimer(){
  LvLTimer1=setTimeout('toggleVis();',100);
}
function toggleVis(){
 var imgDiv = document.getElementById("fullimage");
 var togDiv = document.getElementById("wait");
  if(!document.images["full"].complete){
   togDiv.style.visibility="visible";
   LvLTimer2 = setTimeout('toggleVis();',500);
  }else
  if(document.images["full"].complete){
   var theWidth=document.images["full"].width;
   togDiv.style.visibility="hidden";
   if(LvLTimer1!=null){clearTimeout(LvLTimer1)}
   if(LvLTimer2!=null){clearTimeout(LvLTimer2)}
 }
}
var tgA=new Array(),tq,Fi,tG;
function LvLxx(){
 if(tq<=ezg_T*ezg_R){
 document.getElementById("thumbnavLinks").style.display="none";
 }LvLinitPop=1;setInit=true;
}
function cmp(t){
 var tg=true,tmp,n1,n2;
 while(tg)
  for(var i=0,tg=false;i<t.length-1;i++){
   if(isNaN(n1=parseInt(t[i].match(/\d+/)))){n1=0}
   if(isNaN(n2=parseInt(t[i+1].match( /\d+/)))){n2=0}
   if(n1>n2){tmp=t[i];t[i]=t[i+1];t[i+1]=tmp;tg=true;
  }
 }
}
var cc="";
function setType(i,nm,iw,iS,cc,cp,t){
var p1="";
 p1+="<a href=\"javascript:;\" onMouseOver=\"LvL_chClass('img"+i+"','thumbOver')\" onMouseOut=\"LvL_chClass('img"+i+"','thumbNorm')\"";
 p1+=" onclick=\"setImage(\'<img id=\\\'"+nm+"\\\' name=\\\'"+nm+"\\\' class=\\\'"+iw+"\\\' src=\\\'"+iS+"\\\' title=\\\'"+cc+"\\\' alt=\\\'"+cc+"\\\'>\');applyTransition(\'full\');";
 p1+=" LvL_dnClass('img"+i+"','thumbNorm','thumbDown');Lvl_showCaption('caption"+cp+"_"+i+"');return false\"><img class=\"thumbNorm\" id=\"img"+i+"\" name=\"img"+i+"\" src=\""+t+"\" border=\"0\"></a>";
 return p1;
}
function decrementStep(dec){
step=step-parseInt(dec);
step2=step2-parseInt(dec);
}
var ezee,thumbStart,firstclass,LvL_p=1,step=0,step2=0,LvLinitPop=0;
var ezg_T=5,ezg_R=1,theLinks=5,grpSet=0,flag=0,imgSet=1,Lvl_cp,cc="";
function writeNavLinks(groupNumber){
 var theNavLinks="",groops=tGG/ezg_R;
 if(groops.toString().indexOf(".")>-1){groopsAct=parseInt(groops)+1}else{groopsAct=groops;}
 var groupB=groupNumber;
 var step3=0;
 for(var f=0;f<theLinks;f++){
  for(var k=0;k<ezee;k++){
    if(step2 < groopsAct){step2++;step3++;
      groupB+=ezg_R;
    break;
   }
  }
 }
 var theDecVal,imgSet=1;
 var lastGroup=((groopsAct-(theLinks-step3))*(ezg_R));
 if(groupB>=lastGroup && ezg_T>1){
 var theDecVal=((theLinks*2)-(theLinks-step3));
 }else
 if(step3 != theLinks && ezg_T==1){
 var theDecVal=((theLinks*2)-(theLinks-step3));
 }else{
 var theDecVal=(theLinks*2);
 }
 var groupA=groupNumber;
 if(step>1){
 theNavLinks +='<a class="linksNorm" href="javascript:;" onclick="decrementStep(\''+parseInt(theDecVal)+'\');writeNavLinks('+(groupA-(theLinks*ezg_R))+');setCurrFull(\'bwd\')"><img src="/product/ezeegallery/demos/notheme/images/arrowleft.gif" align="middle" border="0"></a>';
 }
 for(var i=0;i<theLinks;i++){
 if(i>0){imgSet=parseInt(imgSet)+parseInt(ezg_T);}
  for(var j=0;j<ezee+(ezg_T*ezg_R);j++){
    if(j==groupA && step < groopsAct){step++;
      groupA+=ezg_R;
      theNavLinks +='<a class="linksNorm" id="link'+j+'" href="javascript:;" onMouseOver="LvL_chClass2(\'link'+j+'\',\'linksOver\')" onMouseOut="LvL_chClass2(\'link'+j+'\',\'linksNorm\')" onclick="insertTable('+(j-1)+');setCurrFullLinks('+(j-1)+');LvL_dnClass2(\'link'+j+'\',\'linksNorm\',\'linksDown\');if(this.blur)this.blur();return false">'+(step)+'</a>';
    break;
   }
  }
 }
 if(step < groopsAct){
    theNavLinks +='<a class="linksNorm" href="javascript:;" onclick="insertTable('+(j+(ezg_R-1))+');writeNavLinks('+groupA+');setCurrFull(\'fwd\')"><img src="/product/ezeegallery/demos/notheme/images/arrowright.gif" align="middle" border="0"></a>';
 }
 document.getElementById("thumbnavLinks").innerHTML=theNavLinks;
}
function setCurrFullLinks(num){
 var groups = ezee/grpSet;
 if(groups.toString().indexOf(".")>-1){var theActGrps=parseInt(groups)+1}else{var theActGrps=groups;}
 grpSet=(parseInt(ezg_T)*parseInt(num))+1;
  var pat1=/thumbs\/|_thumb/g;
  var oldSrc = document.LvL_p[grpSet].src;
  var newSrc = oldSrc.toString().replace(pat1,"");
  setImage('<img id="full" name="full" class="imgwrap" src="'+newSrc+'">');
  eval("LvL_dnClass('img"+grpSet+"','thumbNorm','thumbDown');LvL_Sid1='img"+grpSet+"'");
  eval("Lvl_showCaption('caption"+Lvl_cp+"_"+grpSet+"')");
}
var theInc=0;
function setCurrFull(dir){
 var grpSet=(parseInt(ezg_R)*parseInt(ezg_T)*theLinks);
 var groups = ezee/grpSet;
 if(groups.toString().indexOf(".")>-1){var theActGrps=parseInt(groups)+1}else{var theActGrps=groups;}
 var theLimit = theActGrps*(ezg_T*theLinks)-theLinks;
 if(dir=="fwd"){if(theInc<theLimit){if(flag==0){theInc=grpSet+1;}else{
  theInc=(parseInt(theInc)+parseInt(grpSet));}flag++;}}else
 if(dir=="bwd"){if(flag>0){flag--;theInc=(parseInt(theInc)-parseInt(grpSet));}}
 var pat1 = /thumbs\/|_thumb/g;
 var oldSrc = document.LvL_p[theInc].src;
 var newSrc = oldSrc.toString().replace(pat1,"");
  setImage('<img id="full" name="full" class="imgwrap" src="'+newSrc+'">');
}
function insertTable(group){
 thumbStart=group;
 var retVal="";
 retVal+='<table border="0" cellspacing="0" cellpadding="0" align="center">';
 for(var i=0;i<ezg_R;i++){
  if(i>0){thumbStart++}
  if(tgA[thumbStart]){
   retVal+='<tr>';
   retVal+='<td>'+tgA[thumbStart]+'</td>';
   retVal+='</tr>';
  }else{break}
 }
 retVal+='</table>';
   document.getElementById("thumbimages").innerHTML=retVal;
}

