// JavaScript Document
$(document).ready(function(){

//	var menupage=$("#menu li");
 	var softwarespages = $("#softwares_menu li");
 	var softwareospages = $("#software_os_menu li");
 	var softwareacpages = $("#software_ac_menu li");
 	var softwareavpages = $("#software_av_menu li");
 	var softwareappages = $("#software_ap_menu li");
 	var softwaregmpages = $("#software_gm_menu li");

function showLoading(){
/*		loading
			.css({visibility:"visible"})
			.css({opacity:"1"})
			.css({display:"block"})
		;
	*/}
	//hide loading bar
	function hideLoading(){
	//	loading.fadeTo(1000, 0);
	};

softwarespages.click(function(){
		getoverlayfun();
    softwarespages.css({'font-weight' : '','border':''});
		$(this).css({'font-weight' : 'bold','border':'1px solid #8e8e8e'});
	  var pageNum = this.id;
		param=pageNum.split("-");
		var targetUrl = "component_content.php?tab=software_product&softwares=softwares&page="+pageNum;
	  $("#softwares_content").load(targetUrl, finish);
	});
	
	softwareospages.click(function(){
	  getoverlayfun();
    softwareospages.css({'font-weight' : '','border':''});
		$(this).css({'font-weight' : 'bold','border':'1px solid #8e8e8e'});
	  var pageNum = this.id;
		param=pageNum.split("-");
		var targetUrl = "component_content.php?tab=software_product&software_id="+pageNum;
	  $("#software_os_content").load(targetUrl, finish);
	});

softwareacpages.click(function(){
    getoverlayfun();
    softwareacpages.css({'font-weight' : '','border':''});
		$(this).css({'font-weight' : 'bold','border':'1px solid #8e8e8e'});
	  var pageNum = this.id;
		param=pageNum.split("-");
		var targetUrl = "component_content.php?tab=software_product&software_id="+pageNum;
	  $("#software_ac_content").load(targetUrl, finish);
	});


softwareavpages.click(function(){
    getoverlayfun();
    softwareavpages.css({'font-weight' : '','border':''});
		$(this).css({'font-weight' : 'bold','border':'1px solid #8e8e8e'});
	  var pageNum = this.id;
		param=pageNum.split("-");
		var targetUrl = "component_content.php?tab=software_product&software_id="+pageNum;
	  $("#software_av_content").load(targetUrl, finish);
	});
 
softwareappages.click(function(){
    getoverlayfun();
    softwareappages.css({'font-weight' : '','border':''});
		$(this).css({'font-weight' : 'bold','border':'1px solid #8e8e8e'});
	  var pageNum = this.id;
		param=pageNum.split("-");
		var targetUrl = "component_content.php?tab=software_product&software_id="+pageNum;
	  $("#software_ap_content").load(targetUrl, finish);
	});
 
 softwaregmpages.click(function(){
    getoverlayfun();
    softwaregmpages.css({'font-weight' : '','border':''});
		$(this).css({'font-weight' : 'bold','border':'1px solid #8e8e8e'});
	  var pageNum = this.id;
		param=pageNum.split("-");
		var targetUrl = "component_content.php?tab=software_product&software_id="+pageNum;
	  $("#software_gm_content").load(targetUrl, finish);
	});
	
	
	function getoverlayfun(){
//$('body').append('<div id="jquery-overlay"></div>');
var arrPageSizes = getPageSize1();
		 $('#jquery-overlay').css({
				backgroundColor:	'#000',
				opacity:			'0.2',
				width:				arrPageSizes[0],
				height:				arrPageSizes[1]
			}).fadeIn();
}

		function getPageSize1() {
			var xScroll, yScroll;
			if (window.innerHeight && window.scrollMaxY) {	
				xScroll = window.innerWidth + window.scrollMaxX;
				yScroll = window.innerHeight + window.scrollMaxY;
			} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
				xScroll = document.body.scrollWidth;
				yScroll = document.body.scrollHeight;
			} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
				xScroll = document.body.offsetWidth;
				yScroll = document.body.offsetHeight;
			}
			var windowWidth, windowHeight;
			if (self.innerHeight) {	// all except Explorer
				if(document.documentElement.clientWidth){
					windowWidth = document.documentElement.clientWidth; 
				} else {
					windowWidth = self.innerWidth;
				}
				windowHeight = self.innerHeight;
			} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
				windowWidth = document.documentElement.clientWidth;
				windowHeight = document.documentElement.clientHeight;
			} else if (document.body) { // other Explorers
				windowWidth = document.body.clientWidth;
				windowHeight = document.body.clientHeight;
			}	
			// for small pages with total height less then height of the viewport
			if(yScroll < windowHeight){
				pageHeight = windowHeight;
			} else { 
				pageHeight = yScroll;
			}
			// for small pages with total width less then width of the viewport
			if(xScroll < windowWidth){	
				pageWidth = xScroll;		
			} else {
				pageWidth = windowWidth;
			}
			arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
			return arrayPageSize;
		};

function finish() {
		var arrPageSizes = getPageSize1();
		$('#jquery-overlay').css("background-position", "top center");
		$('#jquery-overlay').css({
				width:				'2px',
				height:				'2px',
				opacity:			'1',
				display: 'none'
			}).fadeIn();
			$('#jquery-overlay').css({ top:'2px'});
			}
 });