﻿<!--
/*function FindPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft;
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
	{
		curleft += obj.x;
   }
	return curleft;
}*/

var notnat = new RegExp("[^0-9]");
var nat = new RegExp("0*[1-9][0-9]*");

function IsNaturalNumber(strNumber)
{
    var isnotnat = notnat.exec(strNumber);
    var isnat = nat.exec(strNumber);
    
    return (isnotnat == null && isnat != null);
}


function EscapeAll(input)
{
    var localinput = "";
    
    localinput = escape(input);
    //localinput = localinput.replace("&", "&amp;");
    localinput = localinput.replace(/&/g, "&amp;");
    
    return localinput;
}

function EscapeOther(input)
{
    var localinput = "";
    //localinput = input.replace("+", "#plus;");
    localinput = input.replace(/\+/g, "#plus;");
    
    return localinput;
}

function UnEscapeOther(input)
{
    var localinput = "";
    //localinput = input.replace("+", "#plus;");
    localinput = input.replace(/#plus;/g, "+");
    
    return localinput;
}

function quoteXml(inputstr)
{
    var result = inputstr;
    
    result = result.replace(/&/g, "&amp;");
    result = result.replace(/</g, "&lt;");
    result = result.replace(/>/g, "&gt;");
    result = result.replace(/"/g, "&quot;");
    result = result.replace(/'/g, "&apos;");
    
    return result;
}

function limitText(limitField, limitNum) {
    if (limitField.value.length > limitNum) {
        limitField.value = limitField.value.substring(0, limitNum);
    } 
}

function backtotop()
{
    if(window.scrollTo)
        window.scrollTo(0,0);
    
    return false;
}

function FindPosX(obj)
{
    var curleft = 0;
    if(obj.offsetParent)
    {
        while(1)
        {
            curleft += obj.offsetLeft;
            if(!obj.offsetParent)
                break;
            obj = obj.offsetParent;
        }
    }
    else if(obj.x)
        curleft += obj.x;
        
    return curleft;
}


/*function FindPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop;
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
	{
		curtop += obj.y;
   }
	return curtop;
}*/

function FindPosY(obj)
{
    var curtop = 0;
    if(obj.offsetParent)
    {
        while(1)
        {
            curtop += obj.offsetTop;
            if(!obj.offsetParent)
                break;
            obj = obj.offsetParent;
        }
    }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
}


function GetEvent(theEvent)
{
   if (!theEvent) 
	{
	   var theEvent = window.event;
	}
	
	return theEvent;
}

function GetTarget(theEvent)
{
	var targ;
	var theEvent = GetEvent(theEvent);
		
	if (theEvent.target)
	{
	   targ = theEvent.target;
	}
	else if (theEvent.srcElement)
	{
	   targ = theEvent.srcElement;
	}
	
	if (targ.nodeType == 3) // defeat Safari bug
	{
		targ = targ.parentNode;
	} 
		
	return targ;
}

function ToggleBlock(blockId)
{
   if(document.getElementById)
   {
      block = document.getElementById(blockId);     
      if(block.style.display == 'none' || block.style.display == '')
      {
         block.style.display = 'block';
      }
      else
      {        
         block.style.display = 'none';
      }
   }
}

function ToggleBlock2(blockId)
{
    if(document.getElementById)
   {
      block = document.getElementById(blockId);     
      
      if(block.style.display == 'none')
      {
         block.style.display = 'block';
      }
      else if(block.style.display == 'block' ||
              block.style.display == '')
      {
         block.style.display = 'none';
      }
   }
}

function SetCookie(name, value, expires, path, domain, secure)
{
   var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
   document.cookie = curCookie;
}

function GetCookie(name) 
{
   var dc = document.cookie;
   var prefix = name + "=";
   var begin = dc.indexOf("; " + prefix);
   
   if (begin == -1) 
   {
      begin = dc.indexOf(prefix);
      if (begin != 0)
      {
         return null;
      }
   }
   else
   {
      begin += 2;
   }
   
   var end = document.cookie.indexOf(";", begin);
   if (end == -1)
   {
      end = dc.length;
   }
  
   return unescape(dc.substring(begin + prefix.length, end));
}

function GetCurrentRoot()
{
    var pos = window.location.pathname.lastIndexOf("/");
    var retVal = window.location.protocol + "//" + window.location.host + window.location.pathname.substr(0, pos) + "/";
    
    return retVal;
}

function GetPublicXMLHttpRequest()
{
    var newxml = new XMLHttpRequest();
    return newxml;       
}


/* Quick function to redirect to a given URI via ja */
function gotoUri(uri,proto) {
	var hostvar = document.location.hostname;
	if (proto == null || proto == '') {
		var protocol = document.location.protocol;
		if (protocol == "https:") {
			document.location = "http://" + hostvar + uri;
		} else {
			document.location = uri;
		}
	} else {
		document.location = proto + "://" + hostvar + uri;
	}
}

//function which adds to the queue of functions to execute upon window.onload
function addToOnload(newFunc) {
	var currentOnload = window.onload;
	window.onload = function() {
		if(currentOnload != null && typeof currentOnload == "function") {
			currentOnload();
		}
		newFunc();
	};
}
// STARTING NEW!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//function LoadCSS()
//{
//    var css = document.createElement("link");
//    css.href = "../css/temp.css";
//    css.rel = "stylesheet";
//    css.type = "text/css";
//    alert(navigator.userAgent);
//    document.body.appendChild(css);
//}

//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();
-->