var ie = document.all ? true : false;
var ns = document.layers ? true : false;

function mark(maxId,strClass,id,strBigImage,strText){
  if (ie)
    document.write('<span id="naviContent' + id + '" name="naviContent' + id + '" class="' + strClass + '">1/' + maxId + ' </span>');
  else if (ns){
    document.write('<layer class="'+strClass+'" name="naviContent' + id + '" left="690" top="-50">1/' + maxId + '</layer>');
  }
    var theImage     = FWFindImage(document,'imageSmall'+id, 0);
    var intImageId	 = eval(theImage.src.slice(theImage.src.lastIndexOf('_')+1,theImage.src.length-4));
    var strImageName = theImage.src.slice(0,theImage.src.lastIndexOf('_'));
    var strImageLink = '';


	if (strBigImage.indexOf(intImageId)!=-1){
		strImageLink = '<a href="#" onclick="openPopUp(\'' + strImageName + '_0' + intImageId + '_big.jpg\');return false;">' + strText + '</a>';
	}else{
		strImageLink = '';
	}
	if (ie){
		document.all["naviContent"+id].innerHTML= strImageLink + '<img src="/images/space.gif" width="120" height="1">' + intImageId + '/' + maxId; 
	}
	else if (ns)
	  {
	   document.layers["naviContent"+id].moveTo(690,theImage.y+168);
	   document.layers["naviContent"+id].document.open();
	   document.layers["naviContent"+id].document.write('<nobr><font class="'+strClass+'">' + strImageLink +' ' + intImageId+'/'+maxId+'</font></nobr>');
	   document.layers["naviContent"+id].document.close();
	   if (strImageLink!=''){
			document.layers["naviContent"+id].moveBy(-49,0);
		}
	  }
  
}


function openPopUp(imageName){
	f1 = window.open ('/include/i_imagePopUp.asp?ImageBig=' + imageName,"popUp1","toolbar=no,menubar=no,resizable=yes,width=600,height=400");
	f1.focus();
}

function di20(id, intPages,strClass,strBigImage,strText) {

    var theImage     = FWFindImage(document,'imageSmall'+id, 0);
    var intImageId	 = eval(theImage.src.slice(theImage.src.lastIndexOf('_')+1,theImage.src.length-4))+1;
    var strImageName = theImage.src.slice(0,theImage.src.lastIndexOf('_'));
    var strImageLink = '';
	
    if (intImageId <= intPages && intImageId != 1){
		theImage.src = strImageName + '_0' + intImageId + '.jpg';
	}else{
		theImage.src = strImageName + '_01.jpg';
		intImageId = 1;
	}

	if (strBigImage.indexOf(intImageId)!=-1){
		strImageLink = '<a href="#" onclick="openPopUp(\'' + strImageName + '_0' + intImageId + '_big.jpg\');return false;">' + strText + '</a>';
	}else{
		strImageLink = '';
	}
	if (ie){
		document.all["naviContent"+id].innerHTML= strImageLink + '<img src="/images/space.gif" width="120" height="1">' + intImageId + '/' + intPages; 
	}
	else if (ns)
	  {
	   document.layers["naviContent"+id].moveTo(690,theImage.y+168);
	   document.layers["naviContent"+id].document.open();
	   document.layers["naviContent"+id].document.write('<nobr><font class="'+strClass+'">' + strImageLink +' ' + intImageId+'/'+intPages+'</font></nobr>');
	   document.layers["naviContent"+id].document.close();
	   if (strImageLink!=''){
			document.layers["naviContent"+id].moveBy(-49,0);
		}
	  }
}

function FWFindImage(doc, name, j) {
	var theImage = false;
	if (doc.images) {
		theImage = doc.images[name];
	}
	if (theImage) {
		return theImage;
	}
	if (doc.layers) {
		for (j = 0; j < doc.layers.length; j++) {
			theImage = FWFindImage(doc.layers[j].document, name, 0);
			if (theImage) {
				return (theImage);
			}
		}
	}
	return (false);
}

