
//	PerkinElmer Scripts by Bridgeline Software
/*

    - MODAL TOOLTIP LAYERS
    - ENLARGE IMAGE POP WINDOW
	- EXPAND AND COLLAPSE SIDENAV
	- LOGIN
	- CLEAR TEXT OUT OF INPUT
   
*/
// -----------------------------------------------------------------------------------

// MODAL TOOLTIP LAYERS

//Create Test Variable to check for IE6
var version = navigator.userAgent;
var findIE6 = version.indexOf('MSIE 6');

function showModal(){
    // get Object for modal popup to show
    modalObj = document.getElementById("modalCart");
    modalObj.style.display = "block";
    
    // if IE6 show the iframe to cover any select elements
    if(findIE6 != -1) {
        iframeObj = document.getElementById("modalCartiFrame");
        iframeObj.style.display = "block";
        iframeObj.style.height = modalObj.offsetHeight;
    }
}
function hideModal(){
    // get Object for modal popup to hide
    modalObj = document.getElementById("modalCart");
    modalObj.style.display="none";
    
    // if IE6 show the iframe to cover any select elements
    if(findIE6 != -1) {
        iframeObj = document.getElementById("modalCartiFrame");
        iframeObj.style.display="none";
    }
}
function showModal2(){
    // get Object for modal popup to show
    modalObj = document.getElementById("modalContent");
    modalObj.style.display = "block";
    
    // if IE6 show the iframe to cover any select elements
    if(findIE6 != -1) {
        iframeObj = document.getElementById("modalContentiFrame");
        iframeObj.style.display = "block";
        iframeObj.style.height = modalObj.offsetHeight;
    }
}
function hideModal2(){
    // get Object for modal popup to hide
    modalObj = document.getElementById("modalContent");
    modalObj.style.display="none";
    
    // if IE6 show the iframe to cover any select elements
    if(findIE6 != -1) {
        iframeObj = document.getElementById("modalContentiFrame");
        iframeObj.style.display="none";
		}
}

// ENLARGE IMAGE POP WINDOW

function popUpWindow(imagePath){
    var headerinfo = ('<html><head><title>Perkin Elmer</title></head><body style="margin: 0; padding: 0;"><center>');
	var image1 = ('<img src="'+imagePath+'" />');
	var closinginfo = ('</center></body></html>');
	var pagecontent = (headerinfo + "" + image1 + "" + "" + closinginfo);
				
	imageWin = window.open("","History","width=600, height=450, scrollbars=yes, resizable=yes, toolbar=0");
	imageWin.document.write(pagecontent);
	imageWin.document.close();
}


// EXPAND AND COLLAPSE SIDENAV

function expandMenu(currentMenu){
	document.getElementById("section"+currentMenu+"Collapsed").style.display = "none";
	document.getElementById("section"+currentMenu+"Expanded").style.display = "block";
}

function collapseMenu(currentMenu){
	document.getElementById("section"+currentMenu+"Collapsed").style.display = "block";
	document.getElementById("section"+currentMenu+"Expanded").style.display = "none";
}


// LOGIN

var Collapsed = false;

function loginToggle(){
	if (Collapsed){
		document.getElementById("loginCollapsed").className = "closed";
		document.getElementById("login").style.display = "none";
		Collapsed = false;
	} else {
		document.getElementById("loginCollapsed").className = "open";
		document.getElementById("login").style.display = "block";
		Collapsed = true;
	}	
}


// CLEAR TEXT OUT OF INPUT

function clearText(thefield){
		if (thefield.value=="Search...")
		thefield.value = ""
}
// Used in Gallery Refinements
function expandMenu(index){
	document.getElementById("collapsed"+index).style.display = "none";
	document.getElementById("expanded"+index).style.display = "block";
}
function collapsedMenu(index){
	document.getElementById("collapsed"+index).style.display = "block";
	document.getElementById("expanded"+index).style.display = "none";
}


// EXPAND AND COLLAPSE Introductory Text for Gallery Page

function collapsedText(){
	document.getElementById("expandedIText").style.display = "none";	
	document.getElementById("collapsedIText").style.display = "block";
}

function expandText(){
	document.getElementById("expandedIText").style.display = "block";	
	document.getElementById("collapsedIText").style.display = "none";	
	
}


function SetThumbnailSize()
{	
	var obj=document.images;	
	for (var i=0;i<obj.length;i++)
	{
		var img=obj[i];				
		if (img != null && img.id=="imgThumbNail")
		{			
			if(img.width>50 && img.height>50)
			{				
				img.height =50;					
				img.width =50;							
			}
			else if(img.width>50 && img.height<=50)
			{
				dimension=img.height;
				img.width=50;
				img.height=dimension;								
			}
			else if(img.width<=50 && img.height>50)
			{
				dimension=img.width;
				img.height=50;
				img.width=dimension;
			
			}		
		}
	}	
}

