﻿var curSite = window.location.toString().substr(0,window.location.toString().toLowerCase().indexOf('app_')-1).replace('http://','').replace('https://','');
if (curSite.indexOf('/')>0) {curSite='/'+curSite.split('/')[1];} else {curSite='';}
function GetBrowserHeight() 
{
    if (window.innerHeight!=window.undefined) {return window.innerHeight;}
    if (document.compatMode=='CSS1Compat') {return document.documentElement.clientHeight;}
    if (document.body) {return document.body.clientHeight;} 
    return window.undefined; 
}
function GetBrowserWidth() 
{
    if (window.innerWidth!=window.undefined) {return window.innerWidth;}
    if (document.compatMode=='CSS1Compat') {return document.documentElement.clientWidth;}
    if (document.body) {return document.body.clientWidth;} 
    return window.undefined; 
}
function GetElement(obj, par)
{
    var p,i,x,y;
    if (!par) {par=document;}
    if (!x && par.all) {x=par.all[obj];}
    if (!x && document.getElementById) {x=document.getElementById(obj);}
    if (!x && document.getElementByName) {x=document.getElementByName(obj);}
    if (!x && par.layers) {for (i=0;!x && par.layers && i<par.layers.length;i++) {x=GetElement(obj,par.layers[i].document);}}
    if (!x && par.forms) {for (i=0;!x && i<par.forms.length;i++) {x=par.forms[i][obj];}}
    if (!x && par.forms) {for (i=0;!x && i<par.forms.length;i++) {y=par.forms[i]; if (y.id == obj || y.name == obj) {x=y;}}}
    if (!x && par.frames) {for (i=0;!x && i<par.frames.length;i++) {y=par.frames[i]; if (y.id == obj || y.name == obj) {x=y;}}}
    return x;
}
function GetUrlParam(paramName)
{
	var oRegex = new RegExp( '[\?&]' + paramName + '=([^&]+)', 'i' );
	var oMatch = oRegex.exec( window.top.location.search );
	if (oMatch && oMatch.length > 1) {return decodeURIComponent(oMatch[1]);} else {return '';}
}
function GetMaxHeight(nm)
{
    var gHt = 0;
    var oHt = 0;
    if (GetElement(nm).style.height) {oHt=(parseInt(GetElement(nm).style.height.toString())*1)} else {oHt=(parseInt(GetElement(nm).clientHeight.toString())*1)}
    if (document.body.clientHeight<GetBrowserHeight()-10 && document.body.clientHeight>GetBrowserHeight()-20) {gHt=GetElement(nm).style.height;}
    else {gHt=oHt+(GetBrowserHeight()-(document.body.offsetTop*2)-document.body.clientHeight);}
    return gHt;
}        
