﻿// JScript File

<!--
       function current_page(target, imgSrc)
       {
           var element = document.getElementById(target);
           
           
           
           element.style.background = "#51B2F6";         
           element.style.color = "#000000";
           element.style.border = "#F6E751 thin double";
                   
                      
           if (imgSrc)
           {
               element.style.backgroundImage = "url(" + imgSrc + ")";
               element.style.backgroundRepeat = "no-repeat";
           }
           
                     
       }
       
       // Move an element directly on top of another element (and optionally
       // make it the same size)
            function Cover(bottom, top, ignoreSize) {
                var location = Sys.UI.DomElement.getLocation(bottom);
                top.style.position = 'absolute';
                top.style.top = location.y + 'px';
                top.style.left = location.x + 'px';
                if (!ignoreSize) {
                    top.style.height = bottom.offsetHeight + 'px';
                    top.style.width = bottom.offsetWidth + 'px';
                }
            }
            
            
            function insertContent(para, content, link, ref) {
            var p = document.getElementById(para);
            p.innerHTML = content;
            
            if (link && ref)
            {
                p.innerHTML = p.innerHTML + '&nbsp;&nbsp;<a href="' + ref + '">' + link + '</a>';
            }
            }
            
            //Note: tabName variable in source page should reflect the fact that
            //a master page has been used, if one has, e.g. ct100_ContentPlaceHolder1_TableName
            function SetChecked(val,tabName) { 
            var strName=tabName; 
            var table=document.getElementById(strName); 
            var cells=table.getElementsByTagName('td'); 
            var ctlr; 
            for (var i=0; i<cells.length; i++){ 
            ctrl=cells[i].firstChild; 
            if (ctrl.type == 'checkbox') 
            {ctrl.checked=val;} 
            } 
            }
            
            function ClearForm(form) { 
            var strName=form; 
            var form=document.getElementById(strName); 
            var cells=form.getElementsByTagName('input'); 
            var ctlr; 
            for (var i=0; i<cells.length; i++){ 
            ctrl=cells[i]; 
            if (ctrl.type == 'text') 
            {ctrl.value="";} 
            } 
            }
            
            function SetFocus(a_field_id) {
            var control = document.getElementById(a_field_id);
//            $(a_field_id).focus()
            control.focus();
            }
            
            function browserOK()
	        {
	        var browser = BrowserDetect.browser;
	        var version = BrowserDetect.version;
	        
            if ((browser == "Explorer" && version >= "6") || (browser == "Firefox" && version >= "1.5") || 
            (browser == "Opera" && version >= "9") || (browser == "Camino") || (browser == "Chrome") ||
            (browser == "Safari" && version >= "2") || (browser == "Mozilla" && version >= "1.8"))
            {
                return true;
            }
    	        
	        }
	        
	    function ShowHide(showElementId, parentId)
	    {
	        var showElement = document.getElementById(showElementId + "PicGal");
	        var container = document.getElementById(parentId);
	        var divs = container.getElementsByTagName('div');
	       
	       
	        for (var i=0; i<divs.length; i++)
	        {
	           /*alert(divs[i].id);*/
	            var target = divs[i];
	            if (target.id == showElement.id)
	            {
	                if (target.style.display == "none")
	                {
	                    target.style.display = "block";
	                }
	            }
	            else
	            {
	               if (target.style.display == "block")
	                {
	                    target.style.display = "none";
	                }
	            }
	        }
	        	        
	        GrowSidebar(showElementId);
	     }
//	     
//	    function GrowSidebar(showElementId)
//	    {
//	        var picCount = document.getElementById(showElementId + "Count").getAttribute('value');
//	        var extend = document.getElementById("extra");
//	        extend.style.height = "0px";
//	        if(picCount > 6)
//	        {
//	            var groups = (picCount-6)/3;
//	            var amt = 0;
//	            
//	            while (groups > 0)
//	            {
//	                amt += 110;
//	                groups--;
//	            }
//	        
//	            extend.style.height = amt.toString() + "px";
//	        }
//	    }

        function GrowSidebar(showElementId)
	    {
	        var picCount = document.getElementById(showElementId + "Count").getAttribute('value');
	        var extend = document.getElementById("extra");
	        extend.style.height = "0px";
	        if(picCount > 6)
	        {   var groups = 0;
	        
	            if ((picCount-6)%3 == 0 || (picCount-6)%3 == 2)
	            {
	                groups = (picCount-6)/3;
	            }
	            else if ((picCount-6)%3 == 1)
	            {
	                groups = ((picCount-6)/3) + 1;
	            }
	            
	            var amt = 0;
	            
	            while (groups > 0)
	            {
	                amt += 110;
	                groups--;
	            }
	        
	            extend.style.height = amt.toString() + "px";
	        }
	    }
	    
	     function GrowSidebarGrid(rowCount, imgSize)
	    {
//	        var pic = document.getElementById("ImageButton1");
	        var picSize = imgSize;
	        var extend = document.getElementById("extra");
	        var amt = picSize - 275;
	        extend.style.height = "0px";
	        
	        if(rowCount >= 2)
	        {
	            var groups = rowCount;
	            	            
	            while (groups > 0)
	            {
	                amt += 38;
	                groups--;
	            }
	        
	        }
	        extend.style.height = amt.toString() + "px";
	    }
	    
	    
	    function removePic(picture, link)
	    {
	        if (link.innerHTML == "Print Lot Listing Only")
	        {
	            var pic = document.getElementById(picture);
	            pic.style.height = "0px";
	            link.innerHTML = "Print Plat and Prices";
	        }
	        else
	        {
	         window.location.reload(true);
	            link.innerHTML = "Print Lot Listing Only";
               
               
	        }
	    }
	    
	    function restorePic(link)
	    {
	        window.location.reload(true);
	        link.innerHTML = "Print Lot Listing Only";
	    }
	    
	    
	    function gup( name )
        {
        name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
        var regexS = "[\\?&]"+name+"=([^&#]*)";
        var regex = new RegExp( regexS );
        var results = regex.exec( window.location.href );
        if( results == null )
        return "";
        else
        return results[1];
        }
	    
	     
	     
//	     function GrowSidebarGrid(rowCount)
//	    {
//	        var pic = document.getElementById("ImageButton1");
//	        var picSize = pic.offsetHeight;
//	        var extend = document.getElementById("extra");
//	        var amt = picSize - 26;
//	        extend.style.height = "0px";
//	        
//	        if(rowCount > 2)
//	        {
//	            var groups = rowCount;
//	            	            
//	            while (groups > 0)
//	            {
//	                amt += 38;
//	                groups--;
//	            }
//	        
//	        }
//	        extend.style.height = amt.toString() + "px";
//	    }
//	        
          
      -->       


