﻿// JScript File

//################## Begin Popup Image Logic ######################################################

// Set the horizontal and vertical position for the popup

PositionX = 100;
PositionY = 100;

// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)

defaultWidth  = 500;
defaultHeight = 500;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows

var AutoClose = true;

// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
    var isNN = (navigator.appName=="Netscape")?1:0;
    var isIE = (navigator.appName.indexOf("Microsoft")!=-1)?1:0;
} 

if (parent.document.innerWidth){
    //alert("1");
    frameWidth = parent.document.innerWidth;
    frameHeight = parent.document.innerHeight;
}
else if (parent.document.documentElement && parent.document.documentElement.clientWidth){
    //alert("2");
    frameWidth = parent.document.documentElement.clientWidth;
    frameHeight = parent.document.documentElement.clientHeight;
}
else if (parent.document.body){
    //alert("3");
    frameWidth = parent.document.body.clientWidth;
    frameHeight = parent.document.body.clientHeight;
}
//alert("4");
LeftX = (frameWidth - 100) / 2;
TopY = (frameHeight - 100) / 2;

//alert(LeftX + " " + TopY);
var optNN = 'scrollbars=no,titlebar=no,status=no,location=no,directories=no,menubar=0,width='+defaultWidth+',height='+defaultHeight+',left=' + LeftX + ',top=' + TopY;
var optIE = 'scrollbars=no,titlebar=no,status=no,location=no,directories=no,menubar=0,width=100,height=100,left=' + LeftX + ',top=' + TopY;

function popImage(imageURL,imageTitle){

    var arrFile = imageURL.split("Thumbs/");
    var NewImagePath = arrFile[0] + arrFile[1];
    
    //alert(NewFilePath);
    var imgWin;

    if (isNN){
        imgWin=window.open('about:blank','win',optNN);
    }
    if (isIE){
        imgWin=window.open('about:blank','win',optIE);
    }
 
    with (imgWin.document){
    
        writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');
        writeln('<sc'+'ript>');
        writeln('   var isNN,isIE;');
        writeln('   if (parseInt(navigator.appVersion.charAt(0))>=4){');
        writeln('       isNN=(navigator.appName=="Netscape")?1:0;');
        writeln('       isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
        writeln('   function reSizeToImage(){');
        writeln('       if (isIE){');
        //writeln('           window.resizeTo(100,100);');
        writeln('           width = document.images[0].width;');
        writeln('           height = document.images[0].height;')
        writeln('           window.resizeTo(width,height);');
        writeln('           window.moveBy(((width / 2) * -1) + 10,((height / 2) * -1) + 150);}');
        writeln('       if (isNN){');       
        writeln('           window.innerWidth=document.images["Photo"].width;');
        writeln('           window.innerHeight=document.images["Photo"].height;}}');
        writeln('   function doTitle(){document.title="'+imageTitle+'";}');
        writeln('</sc'+'ript>');
        
       
       
        if (!AutoClose){
            writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
        }else{ 
            writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
        }
        
        writeln('<img name="Photo" src="' + NewImagePath + '" style="display:block"></body></html>');
        close();		
    }
}


function detectBrowser(){
    var isNN=(navigator.appName=="Netscape")?1:0;
    var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;
    
    alert("NN: " + isNN);
    alert("IE: " + isIE);
}

function correctPNG() 
    //http://forums.macrumors.com/archive/index.php/t-50459.html
    // correctly handle PNG transparency in Win IE 5.5 or higher.
    {
    for(var i=0; i<document.images.length; i++)
    {
    var img = document.images[i]
    var imgName = img.src.toUpperCase()
    if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
    {
    var imgID = (img.id) ? "id='" + img.id + "' " : ""
    var imgClass = (img.className) ? "class='" + img.className + "' " : ""
    var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
    var imgStyle = "display:inline-block;" + img.style.cssText 
    var imgAttribs = img.attributes;
    for (var j=0; j<imgAttribs.length; j++)
    {
    var imgAttrib = imgAttribs[j];
    if (imgAttrib.nodeName == "align")
    { 
    if (imgAttrib.nodeValue == "left") imgStyle = "float:left;" + imgStyle
    if (imgAttrib.nodeValue == "right") imgStyle = "float:right;" + imgStyle
    break
    }
    }
    var strNewHTML = "<span " + imgID + imgClass + imgTitle
    strNewHTML += " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
    strNewHTML += "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
    strNewHTML += "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
    img.outerHTML = strNewHTML
    i = i-1
    }
    }
    }
    
    window.attachEvent("onload", correctPNG);
    
  function pageLoads()             
        {
            //alert(target);
            var extenderName = "ctl00_ContentPlaceHolder1_ucNavigationControl_SideMenu_AccordionExtender"; //"<%=SideMenu.ClientID %>_AccordionExtender";
            var accordion = $find(extenderName);
            alert(accordion);
            /*
            if(target == 'About Us'){
            
                accordion.get_Pane(0).content.style.display = "inline";  
                accordion.get_Pane(1).content.style.display = "none";  
                accordion.get_Pane(2).content.style.display = "none";  
                accordion.get_Pane(3).content.style.display = "none"; 
                 
            }else if(target == 'Products') {
            
                accordion.get_Pane(0).content.style.display = "none";  
                accordion.get_Pane(1).content.style.display = "inline";  
                accordion.get_Pane(2).content.style.display = "none";  
                accordion.get_Pane(3).content.style.display = "none"; 
            
            }else if(target == 'Customer Support') {
            
                accordion.get_Pane(0).content.style.display = "none";  
                accordion.get_Pane(1).content.style.display = "none";  
                accordion.get_Pane(2).content.style.display = "inline";  
                accordion.get_Pane(3).content.style.display = "none"; 
            
            }else if(target == 'Legal') {
            
                accordion.get_Pane(0).content.style.display = "none";  
                accordion.get_Pane(1).content.style.display = "none";  
                accordion.get_Pane(2).content.style.display = "none";  
                accordion.get_Pane(3).content.style.display = "inline";     
            
            }*/
        }
 function openWindow(theURL,winName,LayoutType) { //v2.0

	var InitialURL = theURL;
	var ImagePath;
	var FileName;
	var FormattedURL;
	var TheFeatures;
	
	if(LayoutType == 'L'){
		TheFeatures = "width=481,height=366";
	}else{
		TheFeatures = "width=366,height=481";
	}
	
	arrTest = new Array();
	arrTest = InitialURL.split("Thumbs/");
	ImagePath = arrTest[0];
	FileName = arrTest[1];
	FormattedURL = ImagePath + FileName;
	//alert(FormattedURL);
    window.open(FormattedURL,winName,TheFeatures);
}

function Highlite(Target){

   //alert(Target.style.backgroundImage);

    //if(Target.style.backgroundImage == ''){
    if(Target.className == 'cell_onblur'){
        //Target.style.backgroundImage = 'url(Images/product_on.jpg)';
        Target.className = 'cell_onfocus';
    }else{
        //Target.style.backgroundImage = '';
        Target.className = 'cell_onblur';
    }
}

function opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
} 

//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
} 

    

