// JavaScript Document
//JavaScript Functions that dynamically adjust iFrame and DIV tag Weight  
function getMyWidth() {
  var myWidth = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;  
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;   
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;   
  }
  return myWidth; 
}

//JavaScript Functions that dynamically adjust iFrame and DIV tag Height 
function getMyHeight() {
  var myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE    
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'    
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible   
    myHeight = document.body.clientHeight;
  }
  return myHeight; 
}

//this function adjusts the height of a DIV section, it takes the div tag nameID as argument 
function div_changeHeight(myDiv) { 
    //check browser screen height compatibility for div section size	
	if (window.screen.height <= gVar_chkForScrnSize) {
		// set div section height to value contained in global variable		
	    document.getElementById(myDiv).style.height = gVar_Static_divSize_GMap; 
		}
	else { 
		// set div section height dynamically minus offset from top of screen 	   
        document.getElementById(myDiv).style.height=getMyHeight() - gVar_TopOfScr_Offset_GMap; 
  		} 
}

//this functions finds the left offset and top offset values for a browser object, it returns the top offset value, it accepts browser object as required parameter
function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} 
		while (obj = obj.offsetParent);
	}      
	// return [curleft,curtop];
       return [curtop];
}

function resize(myFrame,topOffSet) {	  
    //check browser screen height compatibility for iframe size	
	if (window.screen.height <= gVar_chkForScrnSize) {
		//set iFrame height to value contained in global variable		
	    myFrame.height = gVar_Static_iFrameSize;
	} 
    //check if browser is scrolling past available screen height
	else if ((window.screen.availHeight - topOffSet) < 0)
         {
		  // subtract invisible part (scrolled down) of screen from the screen height
          topOffSet = topOffSet - window.screen.availHeight;
          // topOffSet = getMyHeight() - topOffSet;          
          // dynamically set iFrame height less offset from top of screen
		  myFrame.height=getMyHeight() - topOffSet - 25;      
	     }

	// check if new iFrame height exceeds minimum allowable iFrame height
	else if (gVar_Min_iFrameHeight >= getMyHeight() - topOffSet - 25) 
         {
		  // set iFrame height to minimum allowable height
		  myFrame.height = gVar_Min_iFrameHeight;         
	     }
	else  // dynamically set iFrame height less offset from top of screen
		 { 
		  myFrame.height=getMyHeight() - topOffSet - 25;
		 }
}