﻿/*
 *  __  __   ____  ____    ___              
 * |  \/  | / ___||  _ \  |_ _| _ __    ___ 
 * | |\/| || |  _ | |_) |  | | | '_ \  / __|
 * | |  | || |_| ||  __/   | | | | | || (__ 
 * |_|  |_| \____||_|     |___||_| |_| \___|
 *  
 * Copyright © 2009, MGP, Inc.
 * All rights reserved.
 * 
 * Date: 2009-05-01
 * Developer: PMD
 * Description: Functions and variables for browsers
 *
 */

function  MGP_Presentation_Web_Client_JS_GetType() {
	var clientType = navigator.userAgent;
	if(/MSIE (\d+\.\d+);/.test(clientType)) {	
		clientType = "MSIE " + (RegExp.$1).toString();
	}
	else if(navigator.userAgent.indexOf("Firefox") >= 0){
		clientType = "Firefox";
	}
	else if(navigator.userAgent.indexOf("Chrome") >= 0){
		clientType = "Chrome";
	}
	else if(navigator.userAgent.indexOf("Opera") >= 0){
		clientType = "Opera";
	}
	else if(navigator.userAgent.indexOf("Safari") >= 0){
		clientType = "Safari";
	}
	return clientType;
}

function  MGP_Presentation_Web_Client_JS_GetPageDimension() {
	var pageHeight = 0, pageWidth = 0;
    if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
        //IE 6+ in 'standards compliant mode'
        clientHeight = document.documentElement.clientHeight;
    } 
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        clientHeight = document.body.clientHeight;
    }
	else if( document.window && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        clientHeight = document.body.clientHeight;
    }
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		pageWidth = window.innerWidth;
		pageHeight = window.innerHeight;
	} 
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		pageWidth = document.documentElement.clientWidth;
		pageHeight = document.documentElement.clientHeight;
	} 
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		pageWidth = document.body.clientWidth;
		pageHeight = document.body.clientHeight;
	}
	return {PageHeight: pageHeight, PageWidth: pageWidth};
}


