﻿// JScript File

//var heightPage;
//var homeHegit;
//var browser;

function alert34()
{
      
        //alert(screen.width);
        //alert(screen.height);
        
        var smallscrollArea = document.getElementById("wraptd");
        var scrollArea = window.parent.document.getElementById("wraptd");
        //alert("1"+ findbrowser);
        if(findbrowser=="IE")
        {
        scrollArea.style.height =smallscrollArea.offsetHeight  + 30;
        
        //scrollArea.style.height =smallscrollArea.offsetHeight  + 100;
        //alert(smallscrollArea.offsetHeight + 30);
        var tableHeight=scrollArea.style.height;// smallscrollArea.offsetHeight  + 460;
        //"1440";//
        //var tableHeight=smallscrollArea.offsetHeight  + 100;
        //alert(smallscrollArea.offsetHeight  + 100);
        //homeHegit=tableHeight;
        //browser=findbrowser;
        
       set_cookie ("hmPageHeight", tableHeight);
       set_cookie ("findbrowserHome", findbrowser);
        
        //set_cookie ("hmPageHeight", "1440");
        //set_cookie ("findbrowserHome", "IE");
               
        }
        else
        {
         scrollArea.style.height =smallscrollArea.offsetHeight + 180+ "px";
         var tableHeight=scrollArea.style.height;// smallscrollArea.offsetHeight + 80;
         //homeHegit=tableHeight;
         //browser=findbrowser;
         set_cookie ("hmPageHeight", tableHeight);
         set_cookie ("findbrowserHome", findbrowser);
         
        }


}

 function set_cookie ( name, value, exp_y, exp_m, exp_d, path, domain, secure )
{
  var cookie_string = name + "=" + escape ( value );

  if (exp_y)
  {
    var expires = new Date ( exp_y, exp_m, exp_d );
    cookie_string += "; expires=" + expires.toGMTString();
  }

  if (path)
        cookie_string += "; path=" + escape ( path );

  if (domain)
        cookie_string += "; domain=" + escape ( domain );
  
  if (secure)
        cookie_string += "; secure";
  
  document.cookie = cookie_string;
}


function get_cookie (cookie_name )
   {
    var notf='not found';
    var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );

    if ( results )
    return ( unescape ( results[2] ) );
   else
    return notf;
    }

function adjustHt() 
    {
                
       //alert("hi");
       var smallscrollArea = document.getElementById("wraptd");
       //alert(smallscrollArea);
        var scrollArea = window.parent.document.getElementById("wraptd");
        //alert(scrollArea);
        var hmHeight=get_cookie('hmPageHeight');
       
        var  broswerHome=get_cookie('findbrowserHome');
        
        if(broswerHome=="IE")
        {
          
           if( hmHeight >=(smallscrollArea.offsetHeight +40))
            {
            
            scrollArea.style.height =hmHeight + "px" ;
            //scrollArea.style.height ="1269px" ;
            
           }
           else
           {
                
            //alert(smallscrollArea.offsetHeight);
            scrollArea.style.height =smallscrollArea.offsetHeight + 140 +"px";
            // scrollArea.style.height =hmHeight+"px" ;
            //alert(scrollArea.style.height);
            //scrollArea.style.height =smallscrollArea.offsetHeight +170+"px";
           }
        }
        
        else
        {
        
       var op=smallscrollArea.offsetHeight +30;
     
         if( hmHeight >=op)
           {
           //alert("in mozila1"); 
            //alert("in mozila"+"home");
                   
            scrollArea.style.height =hmHeight +"px" ;
            
           }
           else
           {
            //alert("ts"); 
            //alert("in mozila2");       
            scrollArea.style.height =smallscrollArea.offsetHeight + 240 +"px";
            //alert( scrollArea.style.height);
            
           }
        }
       
        
    }
//function delete_cookie(cookie_name)
//{    
//var cookie_date = new Date();  // current date & time 
//alert("delete cookies by me");   
//cookie_date.setTime(cookie_date.getTime() - 1);    document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();
//}
//function alertHeight()
//{
//alert(hmPageHeight);
//}

//var sub=document.getElementById('wraptd').offsetHeight;
//    alert(sub);
//var windowHeight = document.documentElement.clientHeight;
//window.parent.document.getElementById('wraptd').style.height=(sub+80)+'px';



//alert(sub);
//if(windowHeight-(sub)>0)
//{
////document.getElementById('page').style.height=windowHeight+'px';
//alert("1");
////window.parent.document.getElementById("wraptd").style.height=windowHeight+'px';
//window.parent.document.getElementById("wraptd").style.height=(sub+80)+'px';
//}
//else
//{
////document.getElementById('page').style.height=(sub+80)+'px';
//alert("2");
//window.parent.document.getElementById("wraptd").style.height=(sub+80)+'px';
//}

//}





var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			   string: navigator.userAgent,
			   subString: "iPhone",
			   identity: "iPhone/iPod"
	    },
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();

