﻿   
   	var NS = (navigator.appName=="Netscape")?true:false; 
    
    function FixPic()
    {
        var img_h=document.getElementById("img").offsetHeight;
        var img_w=document.getElementById("img").offsetWidth;
        if (img_h > 540)
        {
            document.getElementById("img").style.height= 540 + "px";
        }
        if (img_w > 640) 
        {
            document.getElementById("img").style.width= 640 + "px";
        }
    }
    
	function FitPic(fitType) { 
	    
		var minWidth = new Number(100);
		var minHeight = new Number(100);
		var imgWidth = document.getElementById("img").width + 12;
		var imgHeight = document.getElementById("img").height;
		if(fitType=='gallery'){
		    iHeight = (NS)?window.innerHeight:document.body.clientHeight + 38; 
		}else{
    		iHeight = (NS)?window.innerHeight:document.body.clientHeight + 38; 
		}

   		document.getElementById("picViewerSep").width = document.getElementById("img").width;
		
		if(minWidth>imgWidth)
			imgWidth=minWidth;	
		
		if(minHeight>iHeight)
			iHeight=minHeight;

		window.resizeTo(imgWidth, iHeight);
		self.focus();
	 }

	function showImg(siteRelativePath,imgID,pid)
	{
	  urlPage = siteRelativePath+'/webSite/Templates/GalleryViewer.aspx?picID=' + imgID + '&pid=' + pid
	  popUpImg = open(urlPage, 'popUpImg', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=650,height=550,left=250, top=150');
	}

	function zoomImg(siteRelativePath,pid,Preview)
	{
	  urlPage = siteRelativePath+'/webSite/Templates/picViewer.aspx?pid=' + pid+"&Preview="+Preview;
	  zoomWin = open(urlPage, 'popUpImg', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=650,height=600,left=250, top=150');
	}

	

