function isChrome(){
	var reg = /chrome/;
	return reg.test( navigator.userAgent.toLowerCase() );
}

function isOpera(){
	var reg = /opera/;
	return reg.test( navigator.userAgent.toLowerCase() );
}

function isSafari(){
	var reg = /webkit/;
	var is_safari_or_chrome = reg.test( navigator.userAgent.toLowerCase() );
		reg = /chrome/;
	var is_chrome = reg.test( navigator.userAgent.toLowerCase() );
	return is_safari_or_chrome && !is_chrome;
}

function isIE8(){
	var userAgent = navigator.userAgent.toLowerCase();
	var version = ''+(userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1];
	var	reg = /msie/;
	var reg1 =/opera/;
	return reg.test( userAgent ) && !reg1.test( userAgent ) && version=='8.0';
}

function isIE7(){
	var userAgent = navigator.userAgent.toLowerCase();
	var version = ''+(userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1];
	var	reg = /msie/;
	var reg1 =/opera/;
	return reg.test( userAgent ) && !reg1.test( userAgent ) && version=='7.0';
}
function isIE(){
	return isIE7 || isIE8();
}


function hideHeaderFooter(){
	jQuery("#header").hide();
    jQuery("#footer").hide();
    jQuery("#main").css("border","none");
    jQuery("#main h1").css("padding","0.3  0 0.541em 15px");
    jQuery("div.inspectorMsg").css("padding","0");
    jQuery(".ui-tabs").css("padding","0");
}

function setSVGIframeHeight(delta){
	delta=-30;
	svgIframeHeight=0;
	// get the page height and set tabContent height to max
	svgIframeHeight = jQuery(window).height();
	var headerH = jQuery("#header").height();
	
	var footerH =2;
	if(jQuery("#footer:visible").length!=0){
		footerH = jQuery("#footer").height()+2*8; // 8px margin top and bottom
	}
	
	
	var inspectorPanelH = jQuery("div.inspectorPanel").height();
	var inspectorMsgH = jQuery("div.inspectorMsg").height();
	if(!inspectorPanelH){
		inspectorPanelH =0;
	}
	if(!inspectorMsgH){
		inspectorMsgH =0;
	}
	//alert(headerH);
	//alert(footerH);
	//alert(inspectorPanelH);
	//alert(inspectorMsgH);
	
	if(isSafari()|| isIE() ||isChrome()){
		delta+=10;
	}
	
	svgIframeHeight -= delta + footerH + headerH +inspectorPanelH + inspectorMsgH;
	if(svgIframeHeight<30){
		svgIframeHeight=30;
	}
	//alert("Before set sigma frame height ["+svgIframeHeight+"]")
	
	jQuery("#tab-graph-iframe").height(svgIframeHeight);
	jQuery("#tab-sigma-iframe").height(svgIframeHeight);
}

