function NotAvailable(theElem){
    theElem.innerHTML = "<s>"+theElem.innerHTML+"</s>";
}

function getWindowWidth(){
	var width;
	if( typeof( window.innerWidth ) == 'number' ) {
	    //Non-IE
	    width = window.innerWidth;
	  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	    //IE 6+ in 'standards compliant mode'
	    width = document.documentElement.clientWidth;
	  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	    //IE 4 compatible
	    width = document.body.clientWidth;
	  }
	return width;
}

function getWindowHeight(){
	var height;
	if( typeof( window.innerWidth ) == 'number' ) {
	  //Non-IE
	  height = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	  //IE 6+ in 'standards compliant mode'
	  height = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	  //IE 4 compatible
	  height = document.body.clientHeight;
	}	
	return height;
}

function getElementTop(elem) {
	if (typeof(elem.pageY) == 'number') {
		offset = elem.parentNode.parentNode.pageY;
		return elem.pageY - offset;
	}else{
		yPos = elem.offsetTop - 20;
		return yPos;
	}
}

function getCurrentYPos() {
    if (document.body && document.body.scrollTop)
      return document.body.scrollTop;
    if (document.documentElement && document.documentElement.scrollTop)
      return document.documentElement.scrollTop;
    if (window.pageYOffset)
      return window.pageYOffset;
    return 0;
}

function getCurrentYPosBottom() {
    var y;
    var test1 = document.body.scrollHeight;
    var test2 = document.body.offsetHeight;
    if (test1 > test2){ // all but Explorer Mac
        y = document.body.scrollHeight;
    }
    else // Explorer Mac;
         //would also work in Explorer 6 Strict, Mozilla and Safari
    {
        y = document.body.offsetHeight;
    }
    y = y - getCurrentYPos() - getWindowHeight();
    return y;
}

/***********************************************
* Disable Text Selection script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
*
* Sample usages
* disableSelection(document.body) //Disable text selection on entire body
* disableSelection(document.getElementById("mydiv")) //Disable text selection on element with id="mydiv"
***********************************************/
function disableSelection(target){
    if (typeof target.onselectstart!="undefined"){ //IE route
	    target.onselectstart=function(){return false}
    }else if (typeof target.style.MozUserSelect!="undefined"){ //Firefox route
	    target.style.MozUserSelect="none";
    }else{ //All other route (ie: Opera)
	    target.onmousedown=function(){return false}
    }
    target.style.cursor = "default";
}

function breakout()
{
    if (window.top!=window.self) 
    {
        window.top.location=document.location.href+"";
    }
}

/*************** Browser Detection *******************/
/*** from http://www.quirksmode.org/js/detect.html ***/
var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();