
var objLib;
var funcLib;
var videoLib;
var videoLibRealFound = true;
var vbsDataSet = false;
//var popupwin = document;

var jsLibDoRestoreBGImage = false;

function JsLibSetBGImage(){
	var obj = arguments[0];
	var ImageSource = arguments[1];
	if(document.getElementById(obj)){
		document.getElementById(obj).style.backgroundImage = "url('" + ImageSource + "')";
	}
}

function JsLibRestoreBGImage(){
	if(jsLibDoRestoreBGImage){
		var ImageID = arguments[0];
		var ImageSource = arguments[1];
		if(document.getElementById(ImageID)){
			document.getElementById(ImageID).style.backgroundImage = "url('" + ImageSource + "')";
		}
	}
	jsLibDoRestoreBGImage = false;
}

function JsLibRestoreBGImageStart(){
	var ImageID = arguments[0];
	var ImageSource = arguments[1];
	var Timeout = arguments[2];
	jsLibDoRestoreBGImage = true;
	setTimeout("JsLibRestoreBGImage('" + ImageID + "', '" + ImageSource + "')", Timeout);
}


function OpenService(){
	var SID = arguments[0];
	var Target = arguments[1];
	var Width = arguments[2];
	var Height = arguments[3];
	
	if(Target == 'popup'){
		window.open('/visa/?SID=' + SID, 'servicepop' + SID, 'location=0,toolbar=0,status=0,width=' + Width + ',height=' + Height); 
	}else if(Target == '_blank'){
		window.open('/visa/?SID=' + SID, 'servicepop' + SID, '');
	}else{
		location.href = '/visa/?SID=' + SID;
	}
}

function loadBottomA_d(CategoryID, ord){
	var a_d_frame = null;
	if(parent.frames['reklam']){
		a_d_frame = parent.frames['reklam']
	}else if(parent.parent.frames['reklam)']){
		a_d_frame = parent.parent.frames['reklam'];
	}
	if(a_d_frame){
		if(a_d_frame.location){
			a_d_frame.location.href = '/visa/bottom_image.aspx?CategoryID=' + CategoryID + '&ord=' + ord;
		}
	}
}

function goLocNavList(){
	this.goData = new Array();
	this.goData = arguments[0].split("|");
	this.pageHref = this.goData[0];
	this.target = this.goData[1];
	if (this.pageHref != ''){
		if (this.target == 4){
			window.open(this.pageHref, 'siteWin', 'location=0,toolbar=0,width=' + this.goData[2] + ',height=' + this.goData[3]);
		}else if (this.target == 3){
			window.open(this.pageHref, '_blank', '');
		}else if (this.target == 5){
			top.location.href = this.pageHref;
		}else{
			location.href = this.pageHref;
		}
	}
}

// Fool those spambots:
function sendTv4Mail(){
	var at = '@';
	var dot = '.';
	location.href = 'ma' + 'il' + 'to:' + arguments[0] + at + 'tv4' + dot + 'se';
}

// Fool those spambots:
function sendBlipMail(){
	var at = '@';
	var dot = '.';
	location.href = 'ma' + 'il' + 'to:' + arguments[0] + at + 'blip' + dot + 'se';
}

// Fool those spambots:
function sendMail(){
	var at = '@';
	location.href = 'ma' + 'il' + 'to:' + arguments[0] + at + arguments[1];
}

// This method translates the id of a "flik" in the old 
// navigation to the new one.
function translateOldFlikToNewFlik(){
	switch(arguments[0]){
		case 1:
			if(location.href.indexOf('/program/') > -1){
				return 2;
			}else{
				return 0;
			}
		case 2:
			return 3;
		case 3:
			if(location.href.indexOf('/spel/') > -1){
				return 7;
			}else{
				return 4;
			}
		case 5:
			if(location.href.indexOf('/lokalt/') > -1){
				return 3;
			}else{
				return 6;
			}
			
		case 4:
			return 5;
		case 6:
			if((location.href.indexOf('/spel/') == -1) && (location.href.indexOf('/blip/') == -1)){
				return 0;
			}else{
				return 7;
			}
		default:
			if(!funcLib.isNumeric(arguments[0])){
				return arguments[0];
			}else{
				return arguments[0] + 1;
			}
	}
	return 0;
}

function setNav(){
	if(arguments[0] != '-1'){
		var flikID = translateOldFlikToNewFlik(arguments[0]);
		switch(flikID){
			case 7:
				flikID = 'tv4_plus';
				break;
		}
		
		var gotFlik = false;
		if(top.frames){
			if(top.frames['tabla']){
				if(top.frames['tabla'].openFlik){
					top.frames['tabla'].openFlik(flikID, '', 1);
					gotFlik = true;
				}
			}
		}
		if(!gotFlik){
			setTimeout('setNav(' + (flikID - 1) + ', 1);', 1000);
		}
	}
}

function noFrames(){
	if (top.location.href != location.href){
		top.location.href = location.href;
	}
}



function loadFrames(nav){
	var gotFrames = false;
	switch(nav){
		case 7:
			nav = 'tv4_plus';
			break;
		case 8:
			nav = 'meditv';
			break;			
		case 9:
			nav = 'tv4_info';
			break;			
	}

	if (top.frames){
		if (top.frames.tabla){
			gotFrames = true;
		}
		if(top.frames.BLIPnav){
			gotFrames = true;
		}
	}
	if (!gotFrames){
		if ((location.href.indexOf('artikel.aspx?ID=') > 0) || (location.href.indexOf('article.aspx?ID=') > 0)){
			this.pos = location.href.indexOf('article.aspx?ID=');
			if(this.pos == -1){
				this.pos = location.href.indexOf('artikel.aspx?ID=');
			}
			this.ID = location.href.substr(this.pos + 16);
			this.pos = this.ID.indexOf('&');
			if (this.pos != -1){
				this.ID = this.ID.substr(0, this.pos);
			}
			// Make sure result is numeric...
			if (funcLib.isNumeric(this.ID)){
				top.location.href = '/visa/?ID=' + this.ID;
			}else{
				//bring_up_frames(nav);
				return true;
			}
		}else{
			var strLoc = location.href;
			var re = /tv4.se/i;
			startpos = strLoc.search(re);		//Letar upp positionen där "tv4.se" börjar
			strLoc = strLoc.slice(startpos + 6);		//Tar bort allting till och med "tv4.se"
			strLoc = funcLibReplace(strLoc, '?', '!');
			strLoc = funcLibReplace(strLoc, '&', '$');
			top.location.href = '/visa/?innehall=' + strLoc;
		}
	}else{
		setNav(nav, 1);
	}
	
}

function bring_up_frames(nav, region){
	loadFrames(nav);
	return false;
}


function vote(qid, vid) {
	if (vid == '0') {
		msgWindow = window.open ('/yesno/results.aspx?qid=' + qid, 'qWindow', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes,width=316,height=300');
		return false;	
	}else if(vid == '-1'){
		msgWindow = window.open ('/yesno/ArticleGradeRegister.aspx?ID=' + qid + '&Title=' + escape(arguments[2]), 'qWindow', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, width=216, height=240');
		location.href = '/openArticle/?ID=' + qid;
		return false;
	}else{	
		msgWindow = window.open ('/yesno/vote.aspx?qid=' + qid + '&vid=' + vid, 'qWindow', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes,resizable=yes,width=316,height=300');
		return false;
	}
}

/********************************************************************************

	Project:	TV4 videoplayer code.
	
	Copyright:	TV4 Interactive (TV4 Interaktiv) 2002	
				
********************************************************************************/
function videoLibNoRealMsg(){
	if (confirm('Du har inte Real Player installerat.\nReal Player behövs för att titta på videoklipet.\nKlicka på OK för att ladda hem Real Player.')){
		window.open('http://sweden.real.com/freeplayer_r1p.html');
	}	
}
	
function videoLibEnableSitePlayer(){
	this.sitePlayerURL = arguments[0];
	this.sitePlayerWidth = arguments[1];
	this.sitePlayerHeight = arguments[2];
}

var currentVmanWindow;

function videoLibOpenWebbTVWindow(){
	var url = 'http://www.tv4.se/bredband/';
	if(arguments[0]){
		url = arguments[0];
	}
	if(url.indexOf('webbtv.tv4.se') > -1){
		url = 'http://www.tv4.se/bredband/';
	}
	window.open(url, '_blank', 'resizable=yes,toolbar=0,status=1,location=0,scrollbars=yes');
}

function FocusVmanWindow(){
	//currentVmanWindow.focus();
}

function videoLibOpenMediaClip(){
	var PlayerType = 'mm';
	if(arguments[1]){
		PlayerType = arguments[1];
	}
	
	if(PlayerType == 'vman'){
		var displayTreeID = '';
		if(arguments[4]){
			if(displayTreeID != '0' && (parseInt(displayTreeID) == displayTreeID)){
				displayTreeID = arguments[4];
			}
		}
		var loc = 'http://www.tv4.se/bredband/category.aspx?progId=' + arguments[0] + '&itemId=' + arguments[2] + '&treeId=' + arguments[3] + '&displayTreeId=' + displayTreeID;
		videoLibOpenWebbTVWindow(loc);
		return;		
	}
	
	if (objLib.mozilla){
		// Check for realplayer:
		videoLibRealFound = false;
		for (var i = 0;i <= (navigator.plugins.length - 1);i++){
			this.plugin = navigator.plugins[i].name.toLowerCase();
			if (this.plugin.indexOf("realplayer") > -1){
				videoLibRealFound = true;
			}
		}			
	}else if((objLib.explorer) && (objLib.windows) && (objLib.browserVersion.substring(0, 1) > '5')){
		videoLibRealFound = vbDetectReal();
	}
	if ((this.sitePlayerURL != '') && (!objLib.netscape)){
		this.myURL = this.sitePlayerURL;
		this.myURL = this.myURL.replace('[ID]', arguments[0]);
		this.myURL = this.myURL.replace('[GUID]', arguments[0]);
		if (videoLibRealFound){
			window.open(this.myURL, 'sitePlayerWindow', 'location=0,status=0,toolbar=0,resizable=no,width=' + this.sitePlayerWidth + ',height=' + this.sitePlayerHeight);
		}else{
			videoLibNoRealMsg();	
		}
	}else{
		if (videoLibRealFound){
			//location.href = '/visa/mediaplay.aspx?ID=' + arguments[0];
			location.href = '/_inc/cls/videolink.asp?ID=' + arguments[0];
		}else{
			videoLibNoRealMsg();
		}
	}
}


function launchPlayerID(ArtiID,CategoryName, MediaID){
	var strURL;
	strURL='/VideoPlayer/video.asp?ArticleID='+ArtiID + '&CategoryName=' + CategoryName + '&VideoID=' + MediaID;
	window.open(strURL,'','height=287,width=429,scrollbars=no,resizable=yes,toolbar=no,status=no');
}
 
function launchPlayerMediaID(ArtiID, MediaID){
	var strURL;
	strURL='/VideoPlayer/video.asp?ArticleID='+ArtiID + '&VideoID=' + MediaID;
	window.open(strURL,'','height=287,width=429,scrollbars=no,resizable=yes,toolbar=no,status=no');
}

function launchPlayerUrl(url){
	var strURL;
	strURL='/VideoPlayer/video.asp?VideoURL=' + url;
	window.open(strURL,'','height=287,width=429,scrollbars=no,resizable=yes,toolbar=no,status=no');
}

function launchPlayerLightID(ArtiID,CategoryName, MediaID){
	var strURL;
	strURL='/VideoPlayer/light/video.asp?ArticleID=' + ArtiID + '&CategoryName=' + CategoryName + '&VideoID=' + MediaID;	
	window.open(strURL, '', 'height=287,width=215,scrollbars=no,resizable=no,toolbar=no,status=no');
}
 
function launchPlayerLightUrl(url,CategoryName){
	var strURL;
	strURL='/VideoPlayer/light/video.asp?VideoURL=' + url + '&CategoryName=' + CategoryName;
	window.open(strURL,'','height=287,width=215,scrollbars=no,resizable=no,toolbar=no,status=no');
} 
function launchVM2002Player(MediaID){
	var strURL;
	strURL='/VideoPlayer/vm2002/video.asp?ID=' + MediaID;
	window.open(strURL,'','height=330,width=442,scrollbars=no,resizable=no,toolbar=no,status=no');
}
function launchPXPlayer(){
	var strURL;
	var MediaID;
	MediaID = arguments[0];
	strURL='/VideoPlayer/positionx/frame.asp?ID=' + MediaID;
	if (arguments[1]){
		strURL += '&SubCategoryID=' + arguments[1];
	}
	window.open(strURL,'','height=287,width=429,scrollbars=no,resizable=no,toolbar=no,status=no');
}
function launchFarmenPlayer(){
	var strURL;
	var MediaID;
	MediaID = arguments[0];
	strURL='/VideoPlayer/farmen/video.asp?ID=' + MediaID;
	if (arguments[1]){
		strURL += '&SubCategoryID=' + arguments[1];
	}
	window.open(strURL,'','height=287,width=489,scrollbars=no,resizable=no,toolbar=no,status=no');
}
function launchGladPlayer(){
	var strURL;
	var MediaID;
	MediaID = arguments[0];
	strURL='/VideoPlayer/gladiatorerna/video.asp?ID=' + MediaID;
	if (arguments[1]){
		strURL += '&SubCategoryID=' + arguments[1];
	}
	window.open(strURL,'','height=287,width=439,scrollbars=no,resizable=no,toolbar=no,status=no');
}
function launchNojePlayer(){
	var strURL;
	var MediaID;
	MediaID = arguments[0];
	strURL='/VideoPlayer/noje/video.asp?ID=' + MediaID; 
	if (arguments[1]){
		strURL += '&SubCategoryID=' + arguments[1];
	}
	window.open(strURL,'','height=288,width=491,scrollbars=no,resizable=no,toolbar=no,status=no');
} 
function launchJulPlayer(){
	var strURL;
	var MediaID;
	MediaID = arguments[0];
	strURL='/VideoPlayer/noje/jul/video.asp?ID=' + MediaID; 
	if (arguments[1]){
		strURL += '&SubCategoryID=' + arguments[1];
	}
	window.open(strURL,'','height=288,width=491,scrollbars=no,resizable=no,toolbar=no,status=no');
} 
function launchNyarPlayer(){
	var strURL;
	var MediaID;
	MediaID = arguments[0];
	strURL='/VideoPlayer/noje/blunder/video.asp?ID=' + MediaID; 
	if (arguments[1]){
		strURL += '&SubCategoryID=' + arguments[1];
	}
	window.open(strURL,'','height=454,width=603,scrollbars=no,resizable=no,toolbar=no,status=no');
} 

function launchCMPlayer(){
	var strURL;
	var MediaID;
	MediaID = arguments[0];
	strURL='/VideoPlayer/campmolloy/billboard.asp?ID=' + MediaID; 
	if (arguments[1]){
		strURL += '&SubCategoryID=' + arguments[1];
	}
	window.open(strURL,'','height=322,width=491,scrollbars=no,resizable=no,toolbar=no,status=no');
} 
function launchAHPlayer(){
	var strURL;
	var MediaID;
	MediaID = arguments[0];
	strURL='/VideoPlayer/Hemma/Video.asp?ID=' + MediaID; 
	if (arguments[1]){
		strURL += '&SubCategoryID=' + arguments[1];
	}
	window.open(strURL,'','height=322,width=491,scrollbars=no,resizable=no,toolbar=no,status=no');
} 
function launchMatPlayer(){
	var strURL;
	var MediaID;
	MediaID = arguments[0];
	strURL='/VideoPlayer/mat/video.asp?ID=' + MediaID;
	if (arguments[1]){
		strURL += '&SubCategoryID=' + arguments[1];
	}
	window.open(strURL,'','height=285,width=449,scrollbars=no,resizable=no,toolbar=no,status=no');
}
/********************************************************************************/
// whitespace characters
var whitespace = " \t\n\r";

function funcLibBlurItem(){
	if (objLib.explorer){
		arguments[0].blur();
	}
}

function funcLibAddFavorite(){
	if(objLib.explorer){
		var url = arguments[0];
		var title = arguments[1];
		window.external.AddFavorite(url, title);
		return true;
	}
	return false;
}

function funcLibAddSidebar() {
	if(arguments[0]){
		var name = arguments[0];
	}
	if(arguments[1]){
		var url = arguments[1];
	}
	if((name == null) || (name == '')){
		name = 'TV4.se Sidebar';
	}
	if((url == null) || (url == '')){
		url = 'http://tv4.se/lopsedel/sidebar.aspx';
	}
	
	if(window.sidebar && window.sidebar.addPanel){
		window.sidebar.addPanel(arguments[0], arguments[1],"");
		return true;
	}else{
		return false;
	}
}

function funcLibCheckInterstitialCookie(){
	var site = arguments[0];
	if ((arguments[1]) && (arguments[1] != '')){
		url = arguments[1];
	}else{
		url = 'interstitial.asp';
	}
	var cookieString = unescape(document.cookie);
	if(cookieString.indexOf('interstitial_' + site) < 0){
		if ((funcLib.queryString('ni') != '1') && (funcLib.queryString('nb') != '1')){
			location.href = url;
		}
	}
}

function funcLibCheckBillboard(CategoryID){
	if(funcLibGetCookie('Billboard_' + CategoryID) == ''){
		if (funcLibQueryString('nb') != '1'){
			if(arguments[1]){
				location.href = 'http://www.tv4.se/visa/billboard/?CID=' + CategoryID;
			}else{
				location.href = '/visa/?innehall=/visa/billboard/!CID=' + CategoryID;
			}
		}
	}
}

function funcLibCheckInterstitial(CategoryID){
	if(funcLibGetCookie('Interstitial_' + CategoryID) == ''){
		if (funcLibQueryString('nb') != '1'){
			top.location.href = '/visa/interstitial/?CID=' + CategoryID;
		}
	}
}

function funcLibGetCookie(){
	var cookieName = arguments[0];
	var lookFor = cookieName + '=';
	var location = document.cookie.indexOf(lookFor);
	if(location == -1){
		return '';
	}
	var cookieValue = document.cookie.substring(location + lookFor.length);
	location = cookieValue.indexOf(';');
	if(location > -1){
		cookieValue = cookieValue.substring(0, location);
	}
	return funcLibTrim(cookieValue);
}

function funcLibSetCookie(){
	var cookieName = arguments[0];
	var cookieValue = arguments[1];
	var expDays = 0;
	var exp = new Date(); 
	if(arguments[2]){
		expDays = arguments[2];
		exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
	}
	
	var currCookie = cookieName + "=" + cookieValue;
	if (expDays > 0){
		currCookie += '; expires=' + exp.toGMTString();
	}
	currCookie += '; path=/';
	document.cookie = currCookie;
}

function funcLibSetInterstitialCookie() {
	var site = arguments[0];
	var value = 'interstitial_' + site;
	var curCookie = site + "=" + escape(value) + ' ;path=/';
	document.cookie = curCookie;
 }
	
function funcLibPageQuery(q) {
	if(q.length > 1){
		this.q = q.substring(1, q.length);
	}else{
		this.q = null;
	}
	
	this.keyValuePairs = new Array();
	
	if(q) {
		for(var i=0; i < this.q.split("&").length; i++) {
			this.keyValuePairs[i] = this.q.split("&")[i];
		}
	}
	this.getKeyValuePairs = function() {
		return this.keyValuePairs; 
	}
	this.getValue = function(s) {
		for(var j=0; j < this.keyValuePairs.length; j++) {
			if(this.keyValuePairs[j].split("=")[0] == s){
				return this.keyValuePairs[j].split("=")[1];
			}
		}
		return false;
	}
	
	this.getParameters = function() {
		var a = new Array(this.getLength());
		for(var j=0; j < this.keyValuePairs.length; j++) {
			a[j] = this.keyValuePairs[j].split("=")[0];
		}
		return a;
	}
	
	this.getLength = function() { 
		return this.keyValuePairs.length; 
	} 
}

function funcLibQueryString(key){
/********************************************************************************

	function:	funcLibQueryString(key)
	
	Purpose:	Returns the value of the item "key" from the current querystring
	
	Indata:		Key to look for
	
	Returns:	Value of key.
				
********************************************************************************/
	var page = new funcLibPageQuery(window.location.search); 
	return unescape(page.getValue(key)); 
}

function funcLibGetRandom(rndStart, rndEnd) {
/********************************************************************************

	function:	funcLibGetRandom(rndStart, rndEnd)
	
	Purpose:	Returns a randomized value between rndStart and rndEnd
	
	Indata:		Numeric value representing where to start randomizer,
				Numeric value representing where to stop randomizer
	
	Returns:	Randomized value.
				
********************************************************************************/
    var range = rndEnd - rndStart + 1; 
    var result = rndStart + Math.floor(Math.random() * range); 
    return result; 
}

/******************************************************************
 function funcLibInStr(string_to_searh, search_for)
 Description:
	Returns the position of the first occurrence of one
	string within another.
******************************************************************/ 
function funcLibInStr(){
	this.str = arguments[0];
	this.look_for = arguments[1];
	this.ret = this.str.indexOf(this.look_for);
	return (this.ret + 1);
}

function funcLibReplace(expression, find, replacement) {
/********************************************************************************

	function:	funcLibReplace(expression, find, replacement)
	
	Purpose:	Replace the occurance of a substring within a string with
				something else.
	
	Indata:		Expression to check, data to look for, data to replace found data
				with.
	
	Returns:	New string with provided data replaced.
				
********************************************************************************/
  if ((find == replacement) || (parseInt(replacement.indexOf(find)) > -1)) {
	alert ('Error!');
    return false;
  }
    
  while (expression.indexOf(find) != -1) {
    var leading = expression.substring(0, expression.indexOf(find));
    var trailing = expression.substring(expression.indexOf(find) + find.length, expression.length);
    expression = leading + replacement + trailing;
  }
  return expression;
}

function funcLibIsEmpty(){
/********************************************************************************

	function:	funcLibIsEmpty()
	
	Purpose:	Checks whether a string is empty or not.
	
	Indata:		String to check.
	
	Returns:	True if string is empty, else False.
				
********************************************************************************/
	this.data = arguments[0];	
	if ((!this.data) ||(this.data == null) || (this.data.length == 0)){
		return true;
	}else{
		return false;
	}
}

function funcLibIsWhiteSpace (){
/********************************************************************************

	function:	funcLibIsWhitespace()
	
	Purpose:	Checks whether a string is whitespaces only/empty or not.
	
	Indata:		String to check.
	
	Returns:	True if string is empty or whitespaces only, else False.
				
********************************************************************************/
	var i;
	this.data = arguments[0];
    if (this.isEmpty(this.data)){
		return true;
	}

    // Search through string's characters one by one
    // until we find a non-whitespace character.
    // When we do, return false; if we don't, return true.
    for (i = 0; i < this.data.length; i++){   
        // Check that current character isn't whitespace.
        var c = this.data.charAt(i);
        if (whitespace.indexOf(c) == -1){
			return false;
		}
    }

    // All characters are whitespace.
    return true;
}

function funcLibIsEmail (){
/********************************************************************************

	function:	funcLibIsEmail()
	
	Purpose:	Checks whether a provide email-address is correct or not.
	
	Indata:		E-mail to check.
	
	Returns:	True or False.
				
********************************************************************************/
	this.email = arguments[0];
	if (!this.email){
		return false;
	}
    if (this.isWhiteSpace(this.email)){
		return false;
	}
	
	if (this.inStr(this.email, '@.') != 0){
		return false;
	}
	
	/**********************************************************
	  these ones you might wanna remove:
	*************************************************************/
	if (this.inStr(this.email, '.@') != 0){
		return false;
	}	

	if (this.email.substr(0, 1) == "."){
		return false;
	}
	/*************************************************************/
	
    var i = 1;
    var dataLength = this.data.length;

    while ((i < dataLength) && (this.data.charAt(i) != "@")){
		i++;
    }

    if ((i >= dataLength) || (this.data.charAt(i) != "@")){
		return false;
	}else{
		i += 2;
	}
	
	this.username = this.email.substr(0, (i - 2));
	this.domain = this.email.substr(i - 1);
	
	// Last char in domain can't be a dot:
	if(this.domain.substr(this.domain.length - 1) == "."){
		return false;
	}
	
	// First char in domain can't be a dot:
	if(this.domain.substr(this.domain.length - 1) == "."){
		return false;
	}	
	
	
	if (this.inStr(this.domain, '..') != 0){
		return false;
	}

    while ((i < dataLength) && (this.data.charAt(i) != ".")){
		i ++;
    }

	for (i2 = 0; i2 < this.username.length; i2++){   
		c = this.username.substr(i2, 1);
		if ((!this.isLetterOrDigit(c)) && (c != '_') && (c != '-') && (c != '.')){
			return false;
		}
	}
	
	for (i2 = 0; i2 < this.domain.length; i2++){   
		c = this.domain.substr(i2, 1);
		if ((!this.isLetterOrDigit(c)) && (c != '_') && (c != '-') && (c != '.')){
			return false;
		}
	}	

    if ((i >= dataLength - 1) || (this.data.charAt(i) != ".")){
		return false;
	}else{
		return true;
	}
}

function funcLibIsLetter (){
/********************************************************************************

	function:	funcLibIsLetter(strDataLetter)
	
	Purpose:	Checks whether the provided character is a letter or not 
				(a-z, A-Z).
	
	Indata:		Character to check.
	
	Returns:	True or False.
				
********************************************************************************/
	strDataLetter = arguments[0];
	return (((strDataLetter >= 'a') && (strDataLetter <= 'z')) || ((strDataLetter >= 'A') && (strDataLetter <= 'Z')));
}

function funcLibIsDigit (){
/********************************************************************************

	function:	funcLibIsDigit(strDataDigit)
	
	Purpose:	Checks whether the provided character is a digit (number) or not.
	
	Indata:		Character to check.
	
	Returns:	True or False.
				
********************************************************************************/
	strDataDigit = arguments[0];
	return ((strDataDigit >= "0") && (strDataDigit <= "9"));
}

function funcLibIsLetterOrDigit (){
/********************************************************************************

	function:	funcLibIsLetterOrDigit(strDataLetterOrDigit)
	
	Purpose:	Checks whether the provided character is a digit (number) or a
				letter.
	
	Indata:		Character to check.
	
	Returns:	True if provided character is a digit (0-9) or character
				(a-z, A-Z)or False.
				
********************************************************************************/
	// Returns true if character c is a letter or digit.
	strDataLetterOrDigit = arguments[0];
	return (this.isLetter(strDataLetterOrDigit) || this.isDigit(strDataLetterOrDigit));
}

// Removes all characters which appear in string bag from string s.
function funcLibRemoveChars (){
/********************************************************************************

	function:	funcLibRemoveChars(strData, bag)
	
	Purpose:	Removes all characters in "bag" from "strData".
	
	Indata:		Data to remove characters from, Characterlist.
	
	Returns:	Data without characters in "bag".
				
********************************************************************************/
	var i;
    var returnString = '';
    strData = arguments[0];
    this.bag = arguments[1];

    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.

    for (i = 0; i < strData.length; i++){   
        // Check that current character isn't whitespace.
        var c = strData.charAt(i);
        if (this.bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}



// Removes all characters which do NOT appear in string bag 
// from string s.

function funcLibKeepChars (){
/********************************************************************************

	function:	funcLibKeepChars(strData, bag)
	
	Purpose:	Removes all characters which do NOT appear in "bag" from "data".
	
	Indata:		Data to remove characters from,
				Characterlist of characters to keep.
	
	Returns:	Data with characters in "bag" left only.
				
********************************************************************************/
	strData = arguments[0];
	this.bag = arguments[1];
	var i;
    var returnString = '';

    // Search through string's characters one by one.
    // If character is in bag, append to returnString.

    for (i = 0; i < strData.length; i++){   
        // Check that current character isn't whitespace.
        var c = strData.charAt(i);
        if (this.bag.indexOf(c) != -1) returnString += c;
    }
    return returnString;
}


function funcLibTrim (){
/********************************************************************************

	function:	funcLibTrim(strTrimData)
	
	Purpose:	Removes all whitespace characters from data.
				Global variable whitespace (see above) defines which characters
				are considered whitespace.
	
	Indata:		Data to trim.
	
	Returns:	Trimmed data.
				
********************************************************************************/
	strTrimData = arguments[0];
	while (strTrimData.substring(0,1) == ' ') {
		strTrimData = strTrimData.substring(1, strTrimData.length);
	}
	while (strTrimData.substring(strTrimData.length-1, strTrimData.length) == ' ') {
		strTrimData = strTrimData.substring(0, strTrimData.length - 1);
	}
  return strTrimData;
}

function funcLibIsAlphabetic (){  
/********************************************************************************

	function:	funcLibIsAlphabetic(data)
	
	Purpose:	Checks whether the provided string (data) is alphabetic or not.
				(a-z, A-Z)
	
	Indata:		Data to check.
	
	Returns:	True or false.
				
********************************************************************************/
	var i;
	strData = arguments[0];
    if (this.isEmpty(strData)) {
		return false;   
	}

    /* Search through string's characters one by one
       until we find a non-alphabetic character.
       When we do, return false; if we don't, return true. */

    for (i = 0; i < strData.length; i++){   
        // Check that current char is letter:
        var c = strData.charAt(i);
        if (!this.isLetter(c)){
			return false;
		}
    }
    // All characters are letters.
    return true;
}

function funcLibIsNumeric (){
/********************************************************************************

	function:	funcLibIsNumeric(strData)
	
	Purpose:	Checks whether the provided string (strData) is numeric or not.
				(0-9)
	
	Indata:		Data to check.
	
	Returns:	True or false.
				
********************************************************************************/
	var i2;
	strData = arguments[0];
    if (this.isEmpty(strData)){ 
		return false;
	}
    /* Search through string's characters one by one
       until we find a non-numeric character.
       When we do, return false; if we don't, return true. */
    for (i2 = 0; i2 < strData.length; i2++){   
        // Check that current character is number or letter.
        var cc = strData.charAt(i2);
        if (!this.isDigit(cc)){
			return false;
		}
    }
    // All characters are numbers or letters.
    return true;
}

function funcLibIsAlphaNumeric (){
/********************************************************************************

	function:	funcLibIsAlphaNumeric(strData)
	
	Purpose:	Checks whether the provided string (strData) is alphanumeric or not.
				(a-z, A-Z, 0-9)
	
	Indata:		Data to check.
	
	Returns:	True or false.
				
********************************************************************************/
	var i;
	strData = arguments[0];
	
    if (this.isEmpty(strData)){ 
		return false;
	}
    /* Search through string's characters one by one
       until we find a non-alphanumeric character.
       When we do, return false; if we don't, return true. */

    for (i = 0; i < strData.length; i++){   
        // Check that current character is number or letter.
        var c = strData.charAt(i);
        if (! (this.isLetter(c) || this.isDigit(c) ) ){
			return false;
		}
    }
    // All characters are numbers or letters.
    return true;
}

function funcLibIsUserLibUserName (){
	var strData = arguments[0];
	
	if (strData == ''){
		return false;
	}
	
	if(strData.length < 4){
		return false;
	}
	
	if(strData.length > 16){
		return false;
	}
	var strTmpData = strData;
	strTmpData = funcLib.replace(strTmpData, '.', '');
	strTmpData = funcLib.replace(strTmpData, '-', '');
	strTmpData = funcLib.replace(strTmpData, '_', '');
	/*strTmpData = funcLib.replace(strTmpData, String.fromCharCode(134), '');
	strTmpData = funcLib.replace(strTmpData, String.fromCharCode(132), '');
	strTmpData = funcLib.replace(strTmpData, String.fromCharCode(148), '');
	strTmpData = funcLib.replace(strTmpData, String.fromCharCode(143), '');
	strTmpData = funcLib.replace(strTmpData, String.fromCharCode(142), '');
	strTmpData = funcLib.replace(strTmpData, String.fromCharCode(153), '');*/
	
	if(strTmpData == ''){
		return true;
	}
	return funcLib.isAlphaNumeric(strTmpData);
}
/********************************************************************************/
/********************************************************************************/
/********************************************************************************/


//				 End funcLib-functions, start objLib-functions.


/********************************************************************************/
/********************************************************************************/
/********************************************************************************/

function objLibErrorMsg(){
	this.msg = arguments[0];
	alert('objLib Error Message:\n\n' + this.msg);
}

function objLibPxFix(){
/********************************************************************************

	function:	objLibPxFix()
	
	Purpose:	Removes 'px' from return values so we always get numeric data.
	
	Indata:		Data to have 'px' removed from.
	
	Returns:	Input-data with 'px' removed.
				
********************************************************************************/
	if (this.opera){
		return arguments[0];
	}else{
		return parseInt(funcLib.replace(arguments[0], 'px', ''));
	}
}

function objLibGetBrowser(){
/********************************************************************************

	function:	objLibGetBrowser()
	
	Purpose:	Sets browser-booleans.
	
	Indata:		Nothing.
	
	Returns:	True if a DOM we can work with was found.
				False if no DOM was found.
				
********************************************************************************/
	this.explorer = false;
	this.mozilla = false;
	this.netscape = false;
	this.opera = false;
	this.windows = false;
	this.browserVersion = '';
	var start_pos;
	var end_pos;
	var currLetter;
	var tmpUserAgent = navigator.userAgent.toLowerCase();

	// Get version;
	if(funcLib.inStr(tmpUserAgent, '; msie ') > 0){
		// IE doesnt quite follow the standard so lets get version
		// The IE-way:
		start_pos = funcLib.inStr(tmpUserAgent, '; msie ');
		for (var i = (start_pos + 6);i<=tmpUserAgent.length - 1;i++){
			currLetter = tmpUserAgent.substr(i, 1);
			if ((funcLib.isNumeric(currLetter)) || (currLetter == '.')){
				this.browserVersion = this.browserVersion + currLetter;
			}else{
				break;
			}
		}
	}else{
		// Other browsers:
		start_pos = funcLib.inStr(tmpUserAgent, '/');
		end_pos = funcLib.inStr(tmpUserAgent, ' ');
		for (var i = (start_pos);i<=end_pos - 1;i++){
			currLetter = tmpUserAgent.substr(i, 1);
			if ((funcLib.isNumeric(currLetter)) || (currLetter == '.')){
				this.browserVersion = this.browserVersion + currLetter;
			}else{
				break;
			}
		}
	}
	
	// Get operating-system;
	if((funcLib.inStr(tmpUserAgent, 'windows') != 0) || 
		(funcLib.inStr(tmpUserAgent, 'win 95') != 0) ||
		(funcLib.inStr(tmpUserAgent, 'win 98') != 0) ||
		(funcLib.inStr(tmpUserAgent, 'win NT') != 0) ||
		(funcLib.inStr(tmpUserAgent, 'win XP') != 0) ||
		(funcLib.inStr(tmpUserAgent, 'win 2000') != 0) ||
		(funcLib.inStr(tmpUserAgent, 'win ME') != 0) ||
		(funcLib.inStr(tmpUserAgent, 'win95') != 0) ||
		(funcLib.inStr(tmpUserAgent, 'win98') != 0) ||
		(funcLib.inStr(tmpUserAgent, 'winNT') != 0) ||
		(funcLib.inStr(tmpUserAgent, 'winXP') != 0) ||
		(funcLib.inStr(tmpUserAgent, 'win2000') != 0) ||
		(funcLib.inStr(tmpUserAgent, 'winME') != 0)
		){
			this.windows = true;
	}	

	if(funcLib.inStr(tmpUserAgent, 'opera') != 0){
		this.mozilla = true;
		this.opera = true;
		return true;
	}
	
	if (document.all){
		this.explorer = true;
		return true;
	}

	if (document.getElementById){
		this.mozilla = true;
		return true;
	}
	
	if (document.layers){
		this.netscape = true;
		return true;
	}
	return false;
}

function objLibGetRef(){
/********************************************************************************

	function:	objLibGetRef(objName)
	
	Purpose:	Returns an correct object-reference for the current DOM.
	
	Indata:		Name of object to get reference for (string).
	
	Returns:	A correct objekt-reference for the current DOM.
				If the object we tried to get a reference for doesnt
				exist the function returns false.
				
********************************************************************************/
	this.objName = arguments[0];
	if (this.mozilla){
		return document.getElementById(this.objName);
	}else if(this.explorer){
		return document.all[this.objName];
	}else if(this.netscape){
		return document.layers[this.objName];
	}
	return false;
}

//objLibCreateDiv (name, left, top, height, width, visible, style, extra)
function objLibCreateDiv (){
	name = arguments[0];
	leftData = arguments[1];
	topData = arguments[2];
	heightData = arguments[3];
	widthData = arguments[4];
	visible = arguments[5];
	style = arguments[6];
	extra = arguments[7];
	this.divData = '';
	if (document.layers){
		this.divData = '<layer name="' + name + '" left="' + leftData + '" top="' + topData + '" visibility=';
		if (visible){
			this.divData += '"show" ';
		}else{
			this.divData += '"hide" ';
		}
		if (heightData != ''){
			this.divData += 'height="' + heightData + '" ';
		}
		if (widthData != ''){
			this.divData += 'width="' + widthData + '" ';
		}		
				
		this.divData += ' "' + extra + '"></layer>';
	}else{
		this.divData += '<div id="' + name + '" style="position:absolute;left:' + leftData + 'px;top:' + topData + 'px;visibility:';
		if (visible){
			this.divData += 'visible;';
		}else{
			this.divData += 'hidden;';
		}
		if (heightData != ''){
			this.divData += 'height:' + heightData + 'px;';
		}
		if (widthData != ''){
			this.divData += 'width:' + widthData + 'px;';
		}		
		this.divData += style + '" "' + extra + '"></div>';
	}
	document.write (this.divData);
}
	


function objLibEnableHelpBox(){
	if (!this.helpBox){
		this.helpBox = true;
		objLibCreateDiv ('objLibHelpBox', 0, 0, '', '', false, '', '');
	}
}

function objLibShowHelp(){
	this.helpBoxEnabled = true;
	if (!this.helpBox){
		this.error('You have forgotten to do ' + this.name + '.enableHelpBox();\nPlace the following code immediately after your <body>-declaration:\n<script language="javascript" type="text/javascript">\nobjLib.enableHelpBox();\n</script>');
		return false;
	}
	this.helpText = arguments[0];
	this.sText = '<table border="0" cellpadding="0" cellspacing="0" bgcolor="000000" style="background-color:#000000"><tr><td><table border="0" cellpadding="2" cellspacing="1"><tr><td bgcolor="#FFFFE1" style="font-family:Verdana,Geneva,Arial,Helvetica;font-size:11px;background-color:#FFFFE1">';
	this.eText = '</td></tr></table></td></tr></table>';
	
	if (arguments[1] == 0){
		this.sText = '';
		this.eText = '';
	}

	this.setContent('objLibHelpBox', this.sText + this.helpText + this.eText);
	this.setZ('objLibHelpBox', 9999999);
	this.move('objLibHelpBox', this.mouseX - 2, this.mouseY + 19);	
	this.show('objLibHelpBox');
}

function objLibHideHelp(){
	this.hide('objLibHelpBox');
	this.helpBoxEnabled = false;
}

function objLibClip() {
/********************************************************************************

	function:	objLibClip(objName, xLeft, yTop, xRight, yBottom)
	
	Purpose:	Handles object-clipping
	
	Indata:		Object to clip,
				xLeft-position, yTop-position, xRight-position,
				yBottom-position
	
	Returns:	True or false depending on success of operation.
				
********************************************************************************/
	this.objName = arguments[0];
	this.objRef = this.getRef(this.objName);
	xLeft = arguments[1];
	yTop = arguments[2];
	xRight = arguments[3];
	yBottom = arguments[4];
	if (this.objRef){
		if (this.netscape){
			this.objRef.clip.top = yTop;
			this.objRef.clip.bottom = yBottom;
			this.objRef.clip.left = xLeft;   
			this.objRef.clip.right = xRight;  
		}else if(this.mozilla){
			this.objRef.style.clip = 'rect(' + yTop + ', ' + xRight + ', ' + yBottom + ', ' + xLeft + ')';
		}else if (this.explorer){
			this.objRef.style.clip = 'rect(' + yTop + ', ' + xRight + ', ' + yBottom + ', ' + xLeft + ')';
		}else{
			return false;
		}
	}else{
		return false;
	}
}
function objLibSetZ(){
/********************************************************************************

	function:	objLibSetZ(objName, zPosition)
	
	Purpose:	Sets z-position for an object
	
	Indata:		Object to set z-index for,
				z-index to set.
	
	Returns:	True or false depending on success of operation.
				
********************************************************************************/
	this.objName = arguments[0];
	this.zPos = arguments[1];
	this.objRef = this.getRef(this.objName);
	
	if (this.objRef){
		if (this.netscape){
			this.objRef.zIndex = this.zPos;
			return true;
		}else{
			this.objRef.style.zIndex = this.zPos;
			return true;
		}
	}else{
		return false;
	}
}


function objLibChangeImg(){
/********************************************************************************

	function:	objLibChangeImg(imgName, imgSrc, [container])
	
	Purpose:	Changes the image-source for an image.
				container is optional and only needs to be provided when the image
				is contained within a layer. The only browser using this argument
				is netscape 4.x
	
	Indata:		Name of image to change source for,
				New image-source,
				container (optional)
	
	Returns:	True or false depending on success of operation.
				
********************************************************************************/
	this.objName = arguments[0];
	this.imgSrc = arguments[1];
	
	if (arguments[2]){
		if (this.netscape){
			if (document.layers[arguments[2]]){
   				setTimeout("document.layers['" + arguments[2] + "'].document.images['" + this.objName + "'].src = '" + this.imgSrc + "'", 0);
   				return true;
   			}else{
   				return false;
   			}
   		}else if ((this.mozilla) || (this.explorer && document.getElementById)){
   			this.objRef = document.images[this.objName];
   			if (this.objRef){
   				if (this.explorer){
   					/* Explorer refuses to show an image the source
   					   has been changed on sometimes.
   					   therefore we need to to some special treatment... */
   					//cImage = new Image();
   					//cImage.src = this.imgSrc;
					var data = this.name + ".hide('" + this.objName + "');document.getElementById('" + this.objName + "').src = '" + this.imgSrc + "';" + this.name + ".show('" + this.objName + "');";
					setTimeout(data, 0);
   				}else{
   					this.objRef.src = this.imgSrc;
   				}
   				return true;
   			}else{
   				return false;
   			}
   		}else{
   			if (document.images[this.objName]){
   				document.images[this.objName].src = this.imgSrc;
    			return true;
   			}else{
   				return false;
   			}
		}
	}else{
		if (document.images[this.objName]){
			setTimeout("document.images['" + this.objName + "'].src = '" + this.imgSrc + "'", 0);
			return true;
		}else{
			return false;
		}
	}
}	

function objLibShow(){
/********************************************************************************

	function:	objLibShow(objName)
	
	Purpose:	Turns visibility on for an object.
	
	Indata:		Name of object to turn visible.
	
	Returns:	True if the object was found, false it the object was not found.
				
********************************************************************************/
	this.objName = arguments[0];
	this.objRef = this.getRef(this.objName);
	if (this.objRef){
		if ((this.mozilla) || (this.explorer)){
			this.objRef.style.visibility = 'visible';
			return true;
		}else if(this.netscape){
			this.objRef.visibility = 'show';
			return true;
		}
		return false;
	}else{
		return false;
	}
}

function objLibHide(){
/********************************************************************************

	function:	objLibHide(objName)
	
	Purpose:	Turns visibility off for an object.
	
	Indata:		Name of object to turn invisible.
	
	Returns:	True if the object was found, false it the object was not found.
				
********************************************************************************/
	this.objName = arguments[0];
	this.objRef = this.getRef(this.objName);
	if (this.objRef){
		if ((this.mozilla) || (this.explorer)){
			this.objRef.style.visibility = 'hidden';
			return true;
		}else if(this.netscape){
			this.objRef.visibility = 'hide';
			return true;
		}
		return false;
	}else{
		return false;
	}
}

function objLibIsVisible(objName){
/********************************************************************************

	function:	objLibIsVisible(objName)
	
	Purpose:	Finds out whether an object is visible or not.
	
	Indata:		Name of object to check visibility for.
	
	Returns:	True if the object is visible, false it the object is hidden.
				This function will also return false if the object wasn't found.
				
********************************************************************************/
	this.objName = arguments[0];
	this.objRef = this.getRef(this.objName);
	if (this.objRef){
		if ((this.mozilla) || (this.explorer)){
			if (this.objRef.style.visibility == 'hidden'){
				return false;
			}else{
				return true;
			}
		}else if (this.netscape){
			if (this.objRef.visibility == 'hide'){
				return false;
			}else{
				return true;
			}		
		}else{
			return false;
		}
	}else{
		return false;
	}
}

function objLibToggleVisibility(){
	this.objName = arguments[0];
	if (this.isVisible(this.objName)){
		return this.hide(this.objName);
	}else{
		return this.show(this.objName);
	}
}

function objLibToggleDisplay(){
	this.objName = arguments[0];
	if (document.getElementById(this.objName)){
		if (document.getElementById(this.objName).style.display == ''){
			document.getElementById(this.objName).style.display = 'none';
			return false;
		}else{
			document.getElementById(this.objName).style.display = '';
			return true;
		}
	}
	return true;
}

function objLibMoveX(){
/********************************************************************************

	function:	objLibMoveX(objName, objXpos)
	
	Purpose:	Moves an object to the specified x-position.
	
	Indata:		Name of object to move, x-position to move to.
	
	Returns:	True if the object was found, false it the object was not found.
				
********************************************************************************/
	this.objName = arguments[0];
	this.objXpos = arguments[1];
	this.objRef = this.getRef(this.objName);
	if (this.objRef){
		if ((this.mozilla) || (this.explorer)){
			this.objRef.style.left = this.objXpos;
			return true;
		}else if(this.netscape){
			this.objRef.left = this.objXpos;
			return true;
		}
		return false;
	}else{
		return false;
	}
}

function objLibMoveY(){
/********************************************************************************

	function:	objLibMoveY(objName, objYpos)
	
	Purpose:	Moves an object to the specified y-position.
	
	Indata:		Name of object to move, y-position to move to.
	
	Returns:	True if the object was found, false it the object was not found.
				
********************************************************************************/
	this.objName = arguments[0];
	this.objYpos = arguments[1];
	this.objRef = this.getRef(this.objName);
	if (this.objRef){
		if ((this.mozilla) || (this.explorer)){
			this.objRef.style.top = this.objYpos;
			return true;
		}else if(this.netscape){
			this.objRef.top = this.objYpos;
			return true;
		}
		return false;
	}else{
		return false;
	}
}

function objLibMove(){
/********************************************************************************

	function:	objLibMove(objName, objXpos, objYpos)
	
	Purpose:	Moves an object to the specified x and y-position.
	
	Indata:		Name of object to move, x-position to move to,
				y-position to move to.
	
	Returns:	True if the object was found, false it the object was not found.
				
********************************************************************************/
	this.objName = arguments[0];
	this.objXpos = arguments[1];
	this.objYpos = arguments[2];
	this.moveX(this.objName, this.objXpos);
	return this.moveY(this.objName, this.objYpos);
}

function objLibGetX(){
/********************************************************************************

	function:	objLibGetX(objName)
	
	Purpose:	Gets the x-position in pixels for an object.
	
	Indata:		Name of object to get position for.
	
	Returns:	Position of object if it was found, false it the object was
				not found.
				
********************************************************************************/
	this.objName = arguments[0];
	this.objRef = this.getRef(this.objName);
	if (this.objRef){
		if (this.mozilla){
			this.xPos = this.pxFix(this.objRef.style.left);
		}else if (this.explorer){
			this.xPos = this.objRef.style.posLeft;
		}else if(this.netscape){
			this.xPos = this.objRef.left;
		}
		if (this.xPos){
			return this.xPos;
		}else{
			return false;
		}
	}else{
		return false;
	}
}

function objLibGetY(){
/********************************************************************************

	function:	objLibGetY(objName)
	
	Purpose:	Gets the y-position in pixels for an object.
	
	Indata:		Name of object to get position for.
	
	Returns:	Position of object if it was found, false it the object was
				not found.
				
********************************************************************************/
	this.objName = arguments[0];
	this.objRef = this.getRef(this.objName);
	if (this.objRef){
		if (this.mozilla){
			this.yPos = this.pxFix(this.objRef.style.top);
		}else if (this.explorer){
			this.yPos = this.objRef.style.posTop;
		}else if(this.netscape){
			this.yPos = this.objRef.top;
		}
		if (this.yPos){
			return this.yPos;
		}else{
			return false;
		}
	}else{
		return false;
	}
}

function objLibGetWidth(){
/********************************************************************************

	function:	objLibGetWidth(objName)
	
	Purpose:	Gets the width in pixels of an object.
	
	Indata:		Name of object to get width for.
	
	Returns:	Width of object if it was found, false it the object was
				not found.
				
********************************************************************************/
	this.objName = arguments[0];
	this.objRef = this.getRef(this.objName);
	if (this.objRef){
		if (this.mozilla){
			this.width = this.pxFix(this.objRef.style.width);
		}else if(this.explorer){
			this.width = this.objRef.clientWidth;
		}else if(this.netscape){
			this.width = this.objRef.document.width;
		}
		if (this.width){
			return this.width;
		}else{
			return false;
		}
	}else{
		return false;
	}
}

function objLibGetHeight(){
/********************************************************************************

	function:	objLibGetHeight(objName)
	
	Purpose:	Gets the height in pixels of an object.
	
	Indata:		Name of object to get height for.
	
	Returns:	Height of object if it was found, false it the object was
				not found.
				
********************************************************************************/
	this.objName = arguments[0];
	this.objRef = this.getRef(this.objName);
	if (this.objRef){
		if (this.mozilla){
			this.height = this.pxFix(this.objRef.style.height);
		}else if(this.explorer){
			this.height = this.objRef.clientHeight;
		}else if(this.netscape){
			this.height = this.objRef.document.height;
		}
		if (this.height){
			return this.height;
		}else{
			return false;
		}
	}else{
		return false;
	}
}

function objLibSlideX(){
/********************************************************************************

	function:	objLibSlideX(objName, px, timeout, stopPx)
		
	Purpose:	Slides an object to the right or left.
		
	Indata:		Name of object to slide, number of pixels to slide each time,
				time between each slide, 
				max or min value when the sliding should be stopped (optional)
		
	Returns:	True or false depending of success or action.
					
********************************************************************************/
	this.objName = arguments[0];
	this.objRef = this.getRef(this.objName);
	if (this.objRef){
		this.px = arguments[1];
		this.cx = this.getX(this.objName);
		this.nx = this.cx + this.px;		
		this.timeout = arguments[2];
		this.stopPx = '';
		this.jsActionOnComplete = '';
		this.moveAgain = true;
		this.doJs = false;
		
		if (arguments[4]){
			if (arguments[4] != ''){
				this.jsActionOnComplete = arguments[4];
			}
		}
				
		if (arguments[3]){
			if (arguments[3] != ''){
				this.stopPx = arguments[3];
				if (this.px >= 0){
					if (this.nx >= this.stopPx){
						this.moveAgain = false;
						this.nx = this.stopPx;
						this.doJs = true;
					}	
				}else{
					if (this.nx <= this.stopPx){
						this.moveAgain = false;
						this.nx = this.stopPx;
						this.doJs = true;
					}				
				}
			}
		}
		this.moveX(this.objName, this.nx);
		if (this.moveAgain){
			this.funcCall = this.name + '.slideX("' + this.objName + '", ' + this.px + ', ' + this.timeout + ', ' + this.stopPx + ', "' + this.jsActionOnComplete + '")';
			setTimeout(this.funcCall, this.timeout);
		}
		if (this.doJs){
			eval(this.jsActionOnComplete);
		}
		return true;
	}
	return false;
}


function objLibSlideY(){
/********************************************************************************

	function:	objLibSlideY(objName, px, timeout, stopPx)
		
	Purpose:	Slides an object to the right or left.
		
	Indata:		Name of object to slide, number of pixels to slide each time,
				time between each slide, 
				max or min value when the sliding should be stopped (optional)
		
	Returns:	True or false depending of success or action.
					
********************************************************************************/
	this.objName = arguments[0];
	this.objRef = this.getRef(this.objName);
	if (this.objRef){
		this.px = arguments[1];
		this.cy = this.getY(this.objName);
		this.nx = this.cy + this.px;		
		this.timeout = arguments[2];
		this.stopPx = '';
		this.jsActionOnComplete = '';
		this.moveAgain = true;
		this.doJs = false;
		
		if (arguments[4]){
			if (arguments[4] != ''){
				this.jsActionOnComplete = arguments[4];
			}
		}
		
		if (arguments[3]){
			if (arguments[3] != ''){
				this.stopPx = arguments[3];
				if (this.px >= 0){
					if (this.nx >= this.stopPx){
						this.moveAgain = false;
						this.nx = this.stopPx;
						this.doJs = true;
					}	
				}else{
					if (this.nx <= this.stopPx){
						this.moveAgain = false;
						this.nx = this.stopPx;
						this.doJs = true;											
					}				
				}
			}
		}
		
		this.moveY(this.objName, this.nx);
		if (this.moveAgain){
			this.funcCall = this.name + '.slideY("' + this.objName + '", ' + this.px + ', ' + this.timeout + ', ' + this.stopPx + ', "' + this.jsActionOnComplete + '")';
			setTimeout(this.funcCall, this.timeout);
		}
		if (this.doJs){
			eval(this.jsActionOnComplete);
		}
		return true;
	}
	return false;
}

function objLibSetContent(){
/********************************************************************************

	function:	objLibSetContent(objName, objContent)
		
	Purpose:	Rewrites the content within objName to the data specified in
				objContent.
		
	Indata:		Name of object to write data to, data to be written
		
	Returns:	True or false depending of success or action.
	
	NOTE:		This function does NOT work in opera.
				There is at the moment no way to do this in opera.
					
********************************************************************************/
	this.objName = arguments[0];
	this.objRef = this.getRef(this.objName);
	this.objContent = arguments[1];
	if (this.objRef){
		if (this.opera){
			/*	unfortionately there is at the moment absolutely NO WAY
				to rewrite content within an object in opera(!) */
		}else if ((this.mozilla) || (this.explorer)){
			this.objRef.innerHTML = this.objContent;
		}else if(this.netscape){
			this.objRef.document.open();		
			this.objRef.document.write(this.objContent);
			this.objRef.document.close();		
		}
	}else{
		return false;
	}
}
function objLibMouseMove(e){
	if (objLib){
		if (objLib.explorer){
			objLib.mouseX = event.clientX + document.body.scrollLeft;
			objLib.mouseY = event.clientY + document.body.scrollTop;
		}else if (!objLib.opera){
			
			objLib.mouseX = e.pageX;
			objLib.mouseY = e.pageY;
		}
		
		if (objLib.helpBoxEnabled){
			objLib.move('objLibHelpBox', objLib.mouseX - 2, objLib.mouseY + 19);
		}
	}
}

function objLibInit(){
/********************************************************************************

	function:	objLibInit()
	
	Purpose:	Creates a new instance of the objLib.
	
	Indata:		ObjectName
	
	Returns:	An object reference to the library.
				
********************************************************************************/
	//Random number for DoubleClick.
	ord = Math.random() * 10000000000000000;
	
	this.helpBox = false;
	this.mouseX = -1;
	this.mouseY = -1;
	this.getBrowser = objLibGetBrowser;
	this.getBrowser();
	this.name = arguments[0];
	this.pxFix = objLibPxFix;
	this.getRef = objLibGetRef;
	this.hide = objLibHide;
	this.show = objLibShow;
	this.move = objLibMove;
	this.moveX = objLibMoveX;
	this.moveY = objLibMoveY;
	this.getX = objLibGetX;
	this.getY = objLibGetY;
	this.getWidth = objLibGetWidth;
	this.getHeight = objLibGetHeight;
	this.slideX = objLibSlideX;
	this.slideY = objLibSlideY;
	this.setContent = objLibSetContent;
	this.isVisible = objLibIsVisible;
	this.toggleVisibility = objLibToggleVisibility;
	this.toggleDisplay = objLibToggleDisplay;
	this.changeImg = objLibChangeImg;
	this.clip = objLibClip;
	this.setZ = objLibSetZ;
	this.showHelp = objLibShowHelp;
	this.hideHelp = objLibHideHelp;
	this.enableHelpBox = objLibEnableHelpBox;
	this.error = objLibErrorMsg;
	this.createDiv = objLibCreateDiv;
	document.onmousemove = objLibMouseMove;
	if (this.netscape){
		document.captureEvents(Event.MOUSEMOVE);
	}
}

function funcLibInit(){
/********************************************************************************

	function:	funcLibInit()
	
	Purpose:	funcLibInit starts a new instance of the funcLib.
	
	Indata:		ObjectName
	
	Returns:	An object reference to the library.
				
********************************************************************************/
	this.name = arguments[0];
	this.replace = funcLibReplace;
	this.inStr = funcLibInStr;
	this.isEmpty = funcLibIsEmpty;
	this.isWhiteSpace = funcLibIsWhiteSpace;
	this.isEmail = funcLibIsEmail;
	this.trim = funcLibTrim;
	this.isDigit = funcLibIsDigit;
	this.isLetter = funcLibIsLetter;
	this.isLetterOrDigit = funcLibIsLetterOrDigit;
	this.isNumeric = funcLibIsNumeric;
	this.isAlphabetic = funcLibIsAlphabetic;
	this.isAlphaNumeric = funcLibIsAlphaNumeric;
	this.removeChars = funcLibRemoveChars;
	this.keepChars = funcLibKeepChars;
	this.getRandom = funcLibGetRandom;
	this.queryString = funcLibQueryString;
	this.checkInterstitialCookie = funcLibCheckInterstitialCookie;
	this.setInterstitialCookie = funcLibSetInterstitialCookie;
	this.checkBillboard = funcLibCheckBillboard;
	this.checkInterstitial = funcLibCheckInterstitial;
	this.setCookie = funcLibSetCookie;
	this.getCookie = funcLibGetCookie;
	this.isUserLibUserName = funcLibIsUserLibUserName;
	this.addFavorite = funcLibAddFavorite;
	this.addSidebar = funcLibAddSidebar;
	this.blurItem = funcLibBlurItem;
}

function videoLibInit(){
/********************************************************************************

	function:	videoLibInit()
	
	Purpose:	videoLibInit starts a new instance of the videoLib.
	
	Indata:		ObjectName
	
	Returns:	An object reference to the library.
				
********************************************************************************/
	this.sitePlayerURL = '';
	this.sitePlayerWidth = '';
	this.sitePlayerHeight = '';
	this.name = arguments[0];
	this.launchPlayerID = launchPlayerID;
	this.launchPlayerMediaID = launchPlayerMediaID;
	this.launchPlayerUrl = launchPlayerUrl;
	this.enableSitePlayer = videoLibEnableSitePlayer;
	this.openMediaClip = videoLibOpenMediaClip;
}

function initLibs(){
	videoLib = new videoLibInit('videoLib');
	funcLib = new funcLibInit('funcLib');
	objLib = new objLibInit('objLib');
}

initLibs();
