// JavaScript Document

	function openAcc(section) {
		$("#contentWrapper").accordion("activate", section);
	}

	$(document).ready(function() {
		//$('a.currentLink').attr('href', 'javascript:');
		//$('html > body > table > tbody > tr > td > table > tbody > tr > td > h2').css('margin-top', '43px');
		$("ul#topnav li").hover(function() { //Hover over event on list item
			//$(this).css({ 'background' : '#1376c9 url(topnav_active.gif) repeat-x'}); //Add background color + image on hovered list item
			$(this).find("span").show(); //Show the subnav
			$('html > body > table > tbody > tr > td > table > tbody > tr > td > h2').stop().animate({marginTop:'50px'}, 'fast');
		} , function() { //on hover out...
			//$(this).css({ 'background' : 'none'}); //Ditch the background
			$(this).find("span").hide(); //Hide the subnav
			$('html > body > table > tbody > tr > td > table > tbody > tr > td > h2').stop().animate({marginTop:'5px'}, 'fast');
		});
		$('#showScroll').html('sdsd');
		$(window).scroll(function() {
			if($(window).scrollTop() > 120) {
				$('#floatingContent').css('position', 'fixed');
				$('#floatingContent').css('top', '90px');
				
				$('#topnav').css('position', 'fixed');
				$('#topnav').css('top', '0px');
				$('#topnav').addClass('shadow');
			} else {
				$('#floatingContent').css('position', 'relative');
				$('#floatingContent').css('top', '0px');
				
				$('#topnav').css('position', 'relative');
				$('#topnav').css('top', '0px');
				$('#topnav').removeClass('shadow');
			}
			
			
		});
		
	});
	
	
function get_window_size() {
  var myWidth = 0, myHeight = 0;
  var size = new Array();
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
/*  window.alert( 'Width = ' + myWidth );
  window.alert( 'Height = ' + myHeight );
*/  
	size['width'] = myWidth;
  	size['height'] = myHeight;
 	return size;
}

function get_center_position(size) {
	size = size.replace(/px/g, '');
	if(size == '' || size == null) {
		alert('Please provide a width value of the popup element to get the center position');
		return false;
	}
	var win_size = get_window_size();
	var win_width = win_size['width'];
	var max_val = Math.max(win_width, size);
	var min_val = Math.min(win_width, size);
	var diff = max_val - min_val;
	var final = Math.round(diff/2);
	return final+'px';
}



	
