/***
 * Global Javascript Include 
 */
if (typeof console == "undefined" || typeof console.log == "undefined") var console = { log: function
() {} }; 

showPopupWindow = function(mFileURL) { //v2.0
  MM_openBrWindow ( mFileURL, 'Corporater', 'status=yes,scrollbars=yes,width=951,height=100');
};

MM_openBrWindow = function(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
};

performAll = function(){
	setDivHeight ();
};

/*
setDivHeight = function (){
	var divh = document.getElementById('innerbodyContainer').offsetHeight+280;
	if (divh>850) {
		document.getElementById('lhs').style.height = (divh)+"px";
	} else {
		document.getElementById('lhs').style.height = "850px";
	}
};

*/
/**/
setDivHeight = function (){
	setDefaultheight();
	var divLeft = document.getElementById('lhs').offsetHeight+20;
	var divContent = document.getElementById('innerbodyContainer').offsetHeight;
    	
	if(divLeft > divContent ) {
		document.getElementById('innerbodyContainer').style.height = (divLeft)+"px";
	}
	
	if(divContent > divLeft ) {
		document.getElementById('lhs').style.height = (divContent)+"px";
	}
	
};


setDefaultheight = function (){
	document.getElementById('innerbodyContainer').style.height = "auto";
	document.getElementById('lhs').style.height = "auto";
	
};

displayLangSwitch = function() {
	
};

$(document).ready(function(){
		$("#contactinfo").hide();
		$("#languageblock").hide();	
		
		$('#global-office-link').click(function(){
			setDefaultheight();
			$('#contactinfo').toggle();	
			$('#global-office-link').toggleClass("expand");
			$('#global-office-link').toggleClass("collapse");
			setDivHeight();
		   });
		
		$("#language-switch").click(function(){
			$("#languageblock").toggle();	
		   });
		
	});



autoPopupResize = function() { //v2.0

  /*** Resize window **/
  var mWinHeight, mWinWidth, mScreenHeight, mScreenWidth;
  var xCoord, yCoord;
  var mImageContainerWidth, mImageContainerHeight;
  var STD_HEIGHT_DIFF, STD_WIDTH_DIFF;
  
  if ($.browser.msie == true) {
    STD_HEIGHT_DIFF = 50;
  } else {
    STD_HEIGHT_DIFF = 90;
  }
  
  if ($.browser.msie == true) {
    STD_WIDTH_DIFF = 60;
  } else {
    STD_WIDTH_DIFF = 60;
  }

  mWinHeight = $(document).height();
  mWinWidth = $(document).width();
  
  mScreenHeight = screen.height;
  mScreenWidth = screen.width;
  
  mImageContainerWidth = $("#popup .img-holder").width();
  mImageContainerHeight = $("#popup .img-holder").height();

  mAvailScreenHeight = mScreenHeight - 30;
  
  mActualWinHeight = mWinHeight+STD_HEIGHT_DIFF;
  
  // refresh resize handle FOR WIdTH
  if (mWinWidth > mImageContainerWidth) {
      if ((mWinWidth - mImageContainerWidth) < STD_WIDTH_DIFF) {
        var tempVal = 0;
        tempVal = mWinWidth - mImageContainerWidth;
        
        mActualWinWidth = mWinWidth+(STD_WIDTH_DIFF -tempVal) ;
      }
      else {
        mActualWinWidth = mWinWidth;
      }
  } else {
        mActualWinWidth = mImageContainerWidth + mSTD_HEIGHT_DIFF;
  }
  
  
  // screen heigth adjust handler
  if (mActualWinHeight >  mAvailScreenHeight) {
      window.resizeTo(mActualWinWidth,mAvailScreenHeight );
  } else {
      window.resizeTo(mActualWinWidth,mActualWinHeight );
  }
  
    
  // Move window 
  if (mActualWinWidth <  mScreenWidth) {
    xCoord = ((mScreenWidth - mActualWinWidth)/2);
    xCoord = Math.floor(xCoord);
    
  } else {
    xCoord = 0;
  }
  
  if (mActualWinHeight <  mAvailScreenHeight) {
    yCoord = ((mAvailScreenHeight - mActualWinHeight)/2);
    yCoord = Math.floor(yCoord);
    
  } else {
    yCoord = 0;
  }
  
  window.moveTo(xCoord,yCoord);

};


/************** NEW YEAR SNOW FALL SCRIPT **************************/
/*
document.write("<script type='text/javascript' src='/assets/js/snowstorm.js'></script>");

 function upSnow()
        {
            var id = 'snow' + (Math.floor(Math.random()*3) + 1);
            var snow = $("#"+id);
            var filler = $("#" + id + " div");
            snow.height(snow.height() + 1);
            filler.height(filler.height() + 1);
        }
 

$(function(){
            snowStorm.flakesMax = 250;
            snowStorm.flakesMaxActive = 100;
            snowStorm.animationInterval = 10;
            snowStorm.snowStick = false;
			snowStorm.followMouse = false;
			snowStorm.flakeWidth = 25;            // max pixel width for snow element
 			snowStorm.flakeHeight = 25;  
			snowStorm.snowColor="#E4E4E4";
			snowStorm.vMaxY=12;
            setTimeout(function(){setInterval('upSnow()', 2000)}, 5000);
			
        });

*/
