function trim(str){
	return $.trim(str);
}

function addLoadEvent(func){
	var oldonload = window.onload; 
	if (typeof window.onload != 'function') { 
		$(document).ready(func);
	} else { 
		$(document).ready(function() { 
		        if (oldonload) { 
				oldonload(); 
			} 
			func(); 
		}); 
	} 
}

function styleAbbr() {
	var isIE = (document.all) ? true:false;
	if( isIE ) {
		$('abbr').each(function(){
		    $(this).before("<span class='abbr'>"+$(this).html()+"<\span>").remove();
		});
	}
}

function insertAfter(newElement,targetElement) {
	$(targetElement).insertAfter(newElement);
}

function addClass(elementId,value) {
	$("#"+element).addClass(value );
}

function getHeight(jQueryElement){
	var element = $(jQueryElement);
	var totalHeight = element.height();
	totalHeight += parseInt(element.css("padding-bottom"), 10) + parseInt(element.css("padding-top"), 10); //Total Padding height
	totalHeight += parseInt(element.css("margin-bottom"), 10) + parseInt(element.css("margin-top"), 10); //Total Margin height
	totalHeight += parseInt(element.css("borderBottomWidth"), 10) + parseInt(element.css("borderTopWidth"), 10); //Total Border height

	return totalHeight;
}

function adjustContainerHeight(tabs, containerId, excludedElements, includedElements){
	
	var maxHeight = 0;

	for(var i = 0; i<tabs.length; i++){
		var tabHeight = tabs[i].height();
		if(tabHeight > maxHeight){
			maxHeight = tabHeight;
		}
	}

	var excludedHeight = 0;
	if(excludedElements){
		for(var i = 0; i<excludedElements.length; i++){	
			excludedHeight += getHeight(excludedElements[i]);
		}
	}

	var includedHeight = 0;
	if(includedElements){
		for(var i = 0; i<includedElements.length; i++){	
			includedHeight += getHeight(includedElements[i]);
		}
	}
	
	var headerHeight = getHeight($("#"+containerId).find(".ui-u h3"));	
	var boxHeight = getHeight($("#"+containerId).find(".box"));
	if(boxHeight < maxHeight+includedHeight-excludedHeight){
		$("#"+containerId).find(".ui-u").css("height", (headerHeight+maxHeight+includedHeight-excludedHeight)+"px");
	}
}

function adjustContainerHeightWithSelector(tabs, containerSelector){
	
	var maxHeight = 0;

	for(var i = 0; i<tabs.length; i++){
		var tabHeight = tabs[i].height();
		if(tabHeight > maxHeight){
			maxHeight = tabHeight;
		}
	}

	var headerHeight = getHeight(containerSelector);
	
	if(boxHeight < maxHeight){
		$(containerSelector).css("height", (headerHeight+maxHeight)+"px");
	}
}

function siminn_popup(link, window_width, window_height) {
	var theTarget = "_blank"; 
  	if ((link.target != null) && (link.target != "")) {
		theTarget = link.target;    
	}
	
	newWin = window.open(link.href, theTarget, "width="+ window_width +", height="+ window_height);
	newWin.focus(); 
	return false;
}

function contactme(slod)  {
	open(slod, "displayWindow", "toolbar=0,location=0, status=0, menubar=0, resizable=0, copyhistory=0, scrollbars=1, width=600,height=620");
}

function kuba(slod)  {
	open(slod, "displayWindow", "toolbar=0,location=0, status=0, menubar=0, resizable=0, copyhistory=0, scrollbars=1, width=770,height=650");
}

function setHeight(id){

	var single = id.length <= 1 ? true : false;

     	if (single && !$("#"+id[0])) {
     		return;
     	}         
    
     	id = single ? $("#"+id[0]).children() : id;		
     
	var maxHeight = 0;
     	jQuery.each(id, function(){
		if(!single){
			maxHeight = $("#"+this)[0].offsetHeight>maxHeight ?  $("#"+this)[0].offsetHeight : maxHeight;
		}
		else{
			maxHeight = this.offsetHeight>maxHeight ? this.offsetHeight : maxHeight;
		}	
	});
     	jQuery.each(id, function(){
		if(!single){
		 	$("#"+this).css("height", maxHeight+"px");	
		}
		else{
			$(this).css("height", maxHeight+"px");		
		}
	});
}

function changeActionAndSubmit(url,elementID)
{
   	var form = $( elementID );
	form.action=url;
   	form.submit();
}

function alternate_init() {
	$("table.alternate_rows").each(function(){
		alternate(this);
	});
}

function replace(s, t, u) {
  	i = s.indexOf(t);
  	r
  	if (i == -1) return s;
	r += s.substring(0,i) + u;
	if ( i + t.length < s.length)
    		r += replace(s.substring(i + t.length, s.length), t, u);
	return r;
}

function alternate(table) {	
	$(table).find(" tr:even").removeClass("odd").addClass("even");
	$(table).find(" tr:odd").removeClass("even").addClass("odd");
}


/*   cookie stuff */
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

/* cookie stuff end */

var cookieNameTextSize = "SiminnR4";
var textSizes = "small;medium;big;huge".split(";");

function setTextSizeCookie(size) {
	eraseCookie(cookieNameTextSize);
	createCookie(cookieNameTextSize, size, 365);
}

function doTextSize(textSizeName, textSizeValue) {
	var bodyElement = document.getElementsByTagName('body')[0];
	bodyElement.style.fontSize = textSizeValue;
	setTextSizeCookie(textSizeName);
	markSelectedTextSize(textSizeName);
}

//font-size monster
function hugeText() { 
	doTextSize("huge", '4em'); 
	try {
		reEqualHeightForRounded();
	} catch (Exception) {
	}
}

function bigText() {
	doTextSize("big", '1em'); 
	try {
		reEqualHeightForRounded();
	} catch (Exception) {
	}
}	
	
function mediumText() {
	doTextSize("medium", '.75em'); 
	try {
		reEqualHeightForRounded();
	} catch (Exception) {
	}
}	
	
function smallText() {
	doTextSize("small", '.7em');
	try {
		reEqualHeightForRoundped();
	} catch (Exception) {
	}
}

function markSelectedTextSize(textSize) {

	for(var i=0; i < textSizes.length; i++) {
		if($("#"+textSizes[i] + "Link")){
			$("#"+textSizes[i] + "Link").removeClass("selectedTextSize");
		}
	}
	$("#"+textSize+"Link").addClass("selectedTextSize");
}

function textResize() {
	var textSize = readCookie(cookieNameTextSize);
	if (textSize != null) {
		eval(textSize + "Text()");
	}
}

/* corner rounding */
function getNoCols(element) {
  	var result = 0;

	if ($(element).hasClass("ui-ga")) {
	    result = 1;
	} else if ($(element).hasClass("ui-gb")) {
	    result = 2;
	} else if ($(element).hasClass("ui-gc")) {
	    result = 3;
	} else if ($(element).hasClass("ui-gd")) {
	    result = 4;
	}
	return result;
}

function roundAllAndEqualHeight(cssRule) {
	var elementRounded = roundAll(cssRule);

	var parent = $(cssRule).parent();
	var noOfCols = getNoCols(parent);
	if(noOfCols > 1){
		for(var i = 0; i<elementRounded.length; i+= noOfCols){
			var idOfElementRounded = new Array();
			for(var j = 0; j < noOfCols && (i+j) < elementRounded.length; j++){
				var elementToEqual = elementRounded[i + j].firstChild.firstChild;
		                if (elementToEqual.id == null || elementToEqual.id.length < 1) {
	                        	elementToEqual.id = "roundAllAndEqualHeight_" + (i + j) + "_" + (new Date()).getTime();
	                    	}
	                    	idOfElementRounded[j] = elementToEqual.id;				
			}
			setHeight(idOfElementRounded);
		}
	}
}

function roundAll(cssRule) {
    	$(cssRule).each(function(){
		roundElement(this);
	});
	return $(cssRule);
}

function roundElement(element) {
    	$(element).html('<div class="rounded"><div class="content"><div class="t"/> '+$(element).html()+'<br class="clear"/></div><div class="b"><div/></div></div>');
}

function reEqualHeightForRounded() {
    var elementRounded = new Array();
    var allDivs = $("div");
    if (allDivs) {
	     	jQuery.each(allDivs, function(){
		if($(this)){
			if ($(this).id != null && $(this).id.indexOf('roundAllAndEqualHeight_') == 0 || $(this).className != null && $(this).className.indexOf('roundAllAndEqualHeight') > -1) {
		            	elementRounded[elementRounded.length] = $(this);
		            	$(this).css(height, "")	;
		        }
		}		
	});
    }

    if (elementRounded != null && elementRounded.length > 1) {
        var noOfCols = getNoCols('.rounded');
        if (noOfCols > 1) {
	    for (var i = 0; i < elementRounded.length; i += noOfCols) {
                var idOfElementRounded = new Array();
                for (var j = 0; j < noOfCols && (i + j) < elementRounded.length; j++) {
                    var elementToEqual = elementRounded[i + j].children()[0].children()[0];
                    if (elementToEqual.id == null || elementToEqual.id.length < 1) {
                        elementToEqual.id = "roundAllAndEqualHeight_" + (i + j) + "_" + (new Date()).getTime();
                    }
                    idOfElementRounded[j] = elementToEqual.id;
                }
                setHeight(idOfElementRounded);
            }
        }
    }
}


function roundLegacyInfoElement(jqueryElement) {
    	var node = jqueryElement.children()[0];

	if(node.nodeName != "P"){
		if(jqueryElement.children().length > 1){
			if(!$(jqueryElement).children.find("P") > 0){
				jqueryElement.html("<div style='padding: 10px 0px; margin 0px'>" + jqueryElement.html() + "</div>");
			}
		}
		else{
			jqueryElement.html("<p>" + jqueryElement.html() + "</p>");
		}
	}

	roundElement(jqueryElement);
	
	if (jqueryElement.hasClassName("info-box")) {
		$(element.children()[0]).addClass("info");
		element.removeClass("info-box");
	} else if (jqueryElement.hasClassName("info-go")) {
		$(element.children()[0]).addClass("successful");
		element.removeClass("info-go");
	} else if (jqueryElement.hasClassName("info-yellow")) {
		$(element.children()[0]).addClass("warning");
		element.removeClass("info-yellow");
	} else if (jqueryElement.hasClassName("info-stop")) {
		$(element.children()[0]).addClass("alert");
		element.removeClass("info-stop");
	} 
}

/* end corner rounding */



/* HtmlIncluder start */

var HtmlIncluder = function(){
	this.include = HtmlIncluder.include;
	this.includeDefaultCallback = HtmlIncluder.includeDefaultCallback;
	this.includeCustomCallback = HtmlIncluder.includeCustomCallback;
}

HtmlIncluder.include = function(parameters){
	if (parameters.callback != null) {
		HtmlIncluder.includeDefaultCallback(parameters.url, parameters.callback);
	} else {
		HtmlIncluder.includeDefaultCallback(parameters.url, parameters.mustContain, parameters.elementIdToReplaceInnerHTML);
	}
}

HtmlIncluder.includeDefaultCallback = function( url, mustContain, elementIdToReplaceInnerHTML ){
	var defaultCallBackCode = 
		  " {"
		+ " 	if (response != undefined) { "
		+ " 		if (response != null) { "			
		+ " 			if (response.html.indexOf('" + mustContain + "') > -1) { "
		+ " 				document.getElementById('" + elementIdToReplaceInnerHTML + "').innerHTML = response.html; "
		+ " 				return; "
		+ " 			} "
		+ " 		} "
		+ " 	} "
		+ " 	document.getElementById('" + elementIdToReplaceInnerHTML + "').innerHTML = '';  "
		+ " }";
	try {
	
		var callbackName = "htmlIncluderCallback_" + url.replace(/[^a-zA-Z0-9]/g, '_') + "_" + elementIdToReplaceInnerHTML;
		var scriptCallback = document.createElement('script');
		scriptCallback.type = 'text/javascript';
		scriptCallback.innerHTML = " function " + callbackName + "(response) " + defaultCallBackCode;
		var head = $("head")[0];
		head.appendChild( scriptCallback );
		
		var scriptFetcher = document.createElement('script');
		scriptFetcher.type = 'text/javascript';
		scriptFetcher.src = "https://thjonustuvefur.siminn.is/tilkynningar/servlet/SiminnHtml2Json?callback=" + callbackName + "&url=" + url;
		head.appendChild( scriptFetcher );
	} catch (Exception) {
		try {
			var head = $("head")[0];
			var scriptFetcher = document.createElement('script');
			scriptFetcher.type = 'text/javascript';
			scriptFetcher.src = "https://thjonustuvefur.siminn.is/tilkynningar/servlet/SiminnHtml2Json?callback=( function(response) " + defaultCallBackCode + ")&url=" + url;
			head.appendChild( scriptFetcher );
		} catch (Exception) {
		}
	}		
}

HtmlIncluder.includeCustomCallback = function( url, callbackName ) {
	try {
		var head = $("head")[0];
		
		var scriptFetcher = document.createElement('script');
		scriptFetcher.type = 'text/javascript';
		scriptFetcher.src = "https://thjonustuvefur.siminn.is/tilkynningar/servlet/SiminnHtml2Json?callback=" + callbackName + "&url=" + url;
		head.appendChild( scriptFetcher );
	} catch (Exception) {
	}			
}
/* HtmlIncluder end */

/* Popup start*/
var Popup = function(){
	this.DEFAULT_LOCATION = 'location=0';
	this.DEFAULT_STATUSBAR = 'statusbar=1';
	this.DEFAULT_SCROLLBARS = 'scrollbars=1';
	this.DEFAULT_MENUBAR = 'menubar=0';
	this.DEFAULT_WIDTH = 'width=800';
	this.DEFAULT_HEIGHT = 'height=640';
	this.isUndefined = Popup.isUndefined;
	this.raw_popup = Popup.raw_popup;
	this.link_popup = Popup.link_popup;
	this.event_popup_features = Popup.event_popup_features;
	this.makePopups = Popup.makePopups;
	this.constructFeatures = Popup.constructFeatures;
}

// MISC CLEANING-AFTER-MICROSOFT STUFF
Popup.isUndefined = function(v){
	var undef;
	return v===undef;
}

Popup.raw_popup = function (url, target, features, classInstance) {
	if (classInstance.isUndefined(features)) features = this._POPUP_FEATURES;
	if (classInstance.isUndefined(target  )) target   = '_blank';
	var theWindow = window.open(url, target, features);
	theWindow.focus();
	return theWindow;
};

Popup.link_popup = function (src, features, classInstance) {
	return this.raw_popup(src.getAttribute('href'), src.getAttribute('target') || '_blank', features, classInstance);
}

Popup.event_popup_features = function (features, classInstance) {
    	return function(e) { 
		classInstance.link_popup(e.currentTarget != null ? e.currentTarget : e.srcElement, features, classInstance); 
		e.preventDefault() ;
	};
}

Popup.makePopups = function (elements) {

	for(var i=0; i < elements.length; i++) {
		var features = this.constructFeatures($(elements[i]).attr("rel"));
		$(elements[i]).bind("click", this.event_popup_features(features, this));
	}
}

Popup.constructFeatures = function(customFeatures){
	if(this.isUndefined(customFeatures) || customFeatures == ''){
		customFeatures = this.DEFAULT_LOCATION+","+this.DEFAULT_STATUSBAR +","+this.DEFAULT_SCROLLBARS+","+this.DEFAULT_MENUBAR+","+this.DEFAULT_WIDTH+","+this.DEFAULT_HEIGHT;

		return customFeatures;
	}

	if(customFeatures.indexOf('location') == -1)
		customFeatures += ','+this.DEFAULT_LOCATION;
	if(customFeatures.indexOf('statusbar') == -1)
		customFeatures += ','+this.DEFAULT_STATUSBAR;
	if(customFeatures.indexOf('scrollbars') == -1)
		customFeatures += ','+this.DEFAULT_SCROLLBARS;
	if(customFeatures.indexOf('menubar') == -1)
		customFeatures += ','+this.DEFAULT_MENUBAR;
	if(customFeatures.indexOf('width') == -1)
		customFeatures += ','+this.DEFAULT_WIDTH;
	if(customFeatures.indexOf('height') == -1)
		customFeatures += ','+this.DEFAULT_HEIGHT;

	return customFeatures;
}

addLoadEvent(function () {
	var popup = new Popup();
	popup.makePopups($('a.popup'));
});

/* Popup end */
/* Mail to start */

addLoadEvent(function () {
	$('a.mailto').each(
	function(item) {
		var index = item.href.indexOf("#");
		if (index > -1 && index < item.href.length - 2) {
			var email = item.href.substring(index + 1);
			var splitt = email.split(";");
			if (splitt.length > 1) {
				$(item).bind("click", function () {
					this.href = "mailto:" + splitt[0] + "@" + splitt[1];
				});
			} else {
				$(item).bind("click", function () {
					this.href = "mailto:" + email + "@siminn.is";
				});
			}
		}
	});
});	
/* Mail to end */



/* popup.js */
/*
if (!Array.prototype.push) Array.prototype.push = function() {
    for (var i=0; i<arguments.length; i++) this[this.length] = arguments[i];
    return this.length;
}

Array.prototype.find = function(value, start) {
    start = start || 0;
    for (var i=start; i<this.length; i++)
        if (this[i]==value)
            return i;
    return -1;
}

Array.prototype.has = function(value) {
    return this.find(value)!==-1;
}
/* end popup stuff */



// get value of query string param

function getQueryParamValue(param) {

            var q = document.location.search || document.location.href.split("#")[1];
            if (q) {
                        var detectIndex = q.indexOf(param +"=");
                        var endIndex = (q.indexOf("&", detectIndex) > -1) ? q.indexOf("&", detectIndex) : q.length;
                        if (q.length > 1 && detectIndex > -1) {
                                    return q.substring(q.indexOf("=", detectIndex)+1, endIndex);
                        } else {
                                    return "";
                        }
            }
}

//$Id: common-large-v5.js 1637 2009-03-20 10:02:42Z ingvig $
//(c) Siminn.is
//Finnur Magnusson - April 2005 - www.siminn.is
//This function generates a flash file url for the selected category. And renders it in a div tag with id=branding
//If the number attribute is -1, a random file is selected from the category directory

function generateFlash (category, number) {
  var prt = location.protocol.indexOf('https')>-1?'https://':'http://';
  var flashFile = prt+'static.siminn.is/siminn/r4/f/'+category+'/';
  if(number >= 0)
    flashFile += number+'.swf';
  else {
    //Fetch file count for the selected category
    switch (category)
{case'c0':fileCount=1;break
case'c1':fileCount=1;break
case'c2':fileCount=1;break
case'c3':fileCount=1;break
case'c4':fileCount=1;break
case'c5':fileCount=1;break
case'c6':fileCount=1;break
case'c7':fileCount=1;break
case'c8':fileCount=1;break
case'c9':fileCount=1;break
case'c10':fileCount=1;break}
    flashFile += Math.floor(Math.random()*fileCount)+'.swf';
  }

var fo;
if(category=='c0'||category=='c6'||category=='c10') {
	fo=new FlashObject(flashFile,"walker","940","280",6,"#ffffff");
	}else{
		fo=new FlashObject(flashFile,"walker","940","120",6,"#ffffff");
		}
fo.write("branding");
}

var FlashObject = function(swf, id, w, h, ver, c) {
            this.swf = swf;
            this.id = id;
            this.width = w;
            this.height = h;
            this.version = ver;
            this.align = "middle";

            this.params = new Object();
            this.variables = new Object();
            this.redirect = "";
            this.sq = document.location.search.split("?")[1] || "";
            this.bypassTxt = "<p>Ert ÃƒÆ’Ã¢â‚¬Â¹ÃƒÂ¢Ã¢â€šÂ¬Ã‚ÂºÃƒÆ’Ã¢â‚¬Â¹ÃƒÂ¢Ã¢â‚¬Å¾Ã‚Â¢ meÃƒÆ’Ã‚Â¯Ãƒâ€šÃ‚Â£Ãƒâ€šÃ‚Â¿ Macromedia Flash viÃƒÆ’Ã‚Â¯Ãƒâ€šÃ‚Â£Ãƒâ€šÃ‚Â¿bÃƒÆ’Ã†â€™ÃƒÂ¢Ã¢â€šÂ¬Ã‚Âºtina uppsetta fyrir vafrann ÃƒÆ’Ã¢â‚¬Â¹ÃƒÂ¢Ã¢â€šÂ¬Ã‚Âºinn? <a href='?detectflash=false&"+ this.sq +"'>Smelltu hÃƒÆ’Ã†â€™Ãƒâ€¹Ã¢â‚¬ r ef ÃƒÆ’Ã¢â‚¬Â¹ÃƒÂ¢Ã¢â€šÂ¬Ã‚ÂºÃƒÆ’Ã¢â‚¬Â¹ÃƒÂ¢Ã¢â‚¬Å¾Ã‚Â¢ er meÃƒÆ’Ã‚Â¯Ãƒâ€šÃ‚Â£Ãƒâ€šÃ‚Â¿ Flash viÃƒÆ’Ã‚Â¯Ãƒâ€šÃ‚Â£Ãƒâ€šÃ‚Â¿bÃƒÆ’Ã†â€™ÃƒÂ¢Ã¢â€šÂ¬Ã‚Âºt nÃƒÆ’Ã¢â‚¬Â¹ÃƒÂ¢Ã¢â‚¬Å¾Ã‚Â¢mer "+ this.version +" uppsetta</a>.</p>";

            if (c) this.color = this.addParam('bgcolor', c);
            this.addParam('quality', 'high'); // default to high
            this.doDetect = getQueryParamValue('detectflash');
}
var FOP = FlashObject.prototype;

FOP.addParam = function(name, value) { this.params[name] = value; }
FOP.getParams = function() { return this.params; }
FOP.getParam = function(name) { return this.params[name]; }
FOP.addVariable = function(name, value) { this.variables[name] = value; }
FOP.getVariable = function(name) { return this.variables[name]; }
FOP.getVariables = function() { return this.variables; }

FOP.getParamTags = function() {
    var paramTags = "";
    for (var param in this.getParams()) {
        paramTags += '<param name="' + param + '" value="' + this.getParam(param) + '" />';
    }
    return (paramTags == "") ? false:paramTags;
}

FOP.getHTML = function() {
    var flashHTML = "";
    if (navigator.plugins && navigator.mimeTypes.length) { // netscape plugin architecture
        flashHTML += '<embed type="application/x-shockwave-flash" src="' + this.swf + '" allowScriptAccess="always" width="' + this.width + '" height="' + this.height + '" id="' + this.id + '" align="' + this.align + '"';
        for (var param in this.getParams()) {
            flashHTML += ' ' + param + '="' + this.getParam(param) + '"';
        }
        if (this.getVariablePairs()) {
            flashHTML += ' flashVars="' + this.getVariablePairs() + '"';
        }
        flashHTML += '></embed>';
    } else { // PC IE
        flashHTML += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + this.width + '" wmode="opaque" height="' + this.height + '" id="' + this.id + '" align="' + this.align + '">';
        flashHTML += '<param name="movie" value="' + this.swf + '" /><param name="allowScriptAccess" value="always" /><param name="wmode" value="opaque" />';
        if (this.getParamTags()) {
            flashHTML += this.getParamTags();
        }

        if (this.getVariablePairs() != null) {
            flashHTML += '<param name="flashVars" value="' + this.getVariablePairs() + '" />';
        }
        flashHTML += '</object>';
    }
    return flashHTML;       
}

FOP.getVariablePairs = function() {
    var variablePairs = new Array();
    for (var name in this.getVariables()) { 
            variablePairs.push(name + "=" + escape(this.getVariable(name))); 
    }
    return (variablePairs.length > 0) ? variablePairs.join("&"):false;
}

FOP.write = function(elementId) {
            if(detectFlash(this.version) || this.doDetect=='false') {
                        if (elementId) {
                                    document.getElementById(elementId).innerHTML = this.getHTML();
                        } else {
                                    document.write(this.getHTML());
                        }
            } else {
                        if (this.redirect != "") {
                                    document.location.replace(this.redirect);
                        } else if (this.altTxt) {
                                    if (elementId) {
                                                document.getElementById(elementId).innerHTML = this.altTxt +""+ this.bypassTxt;
                                    } else {
                                                document.write(this.altTxt +""+ this.bypassTxt);
                                    }
                        }
            }                       
}

 
/* ---- detection functions ---- */
function getFlashVersion() {
            var flashversion = 0;
            if (navigator.plugins && navigator.mimeTypes.length) {
                        var x = navigator.plugins["Shockwave Flash"];
                        if(x && x.description) {
                                    var y = x.description;
                                    flashversion = trim(y.substring(y.indexOf('.')-2, y.indexOf('.')));}}
                                     else {
                        result = false;
                for(var i = 15; i >= 3 && result != true; i--){
                                    execScript('on error resume next: result = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+i+'"))','VBScript');
                                    flashversion = i;
                        }
            }
            return flashversion;
}

function detectFlash(ver) {           return (getFlashVersion() >= ver) ? true:false; }

//ie flash fix - click to actiavte
(function( Eolas_Fixed,
            win, doc,
            getElementsByTagName,
            outerHTML,
            parentNode,
            tags,
            elmsToRemoveOnload,
            x,
            is_ie,
            y,z,elm,childNode,HTML,dummy,eolasfix)
{
  
  if (win[Eolas_Fixed]) return;
  win[Eolas_Fixed] = 1;

  eolasfix = function ()
  {
    
    while (tags[++x])
    {
       
      y = 0;
      while (elm = doc[getElementsByTagName](tags[x])[y++])
      {
        if (is_ie)
        {
          HTML = '>';
          z = 0;
          
          
          while (childNode = elm.childNodes[z++])
              HTML += childNode[outerHTML];

          
          dummy = doc.createElement('i');
          
          elm[parentNode].insertBefore(dummy, elm);
          
          dummy[outerHTML] = elm[outerHTML].replace(/>/, HTML);
          
          y++;
          elm.style.display = 'none';
          elmsToRemoveOnload[elmsToRemoveOnload.length] = elm;
        }
        else
        {
          elm[outerHTML] = elm[outerHTML];
        }
      }
    }
  };

  is_ie && !eolasfix() && win.attachEvent('onload', function(){
    x=0;
    while(elm = elmsToRemoveOnload[x++])
        elm[parentNode].removeChild(elm);
  });
  
  win.opera && doc.addEventListener('DOMContentLoaded', eolasfix, 0);

})( '__Eolas_Fixed',
    window, document,
    'getElementsByTagName',
    'outerHTML',
    'parentNode',
    ['object','embed','applet'],
    [],
    -1 /*@cc_on,1 @*/
  );
/*Tabboxes start*/
TabContainer = function(id, config){

	var i = 0;
	var obj = this;
	this.tabs = {};
	this.id = id;
	this.height = 0;
	this.selectedId;
	
	// functions
	this.clearSelected = TabContainer.clearSelected;
	this.select = TabContainer.select;
	this.height = TabContainer.height;
	this.resetHeight = TabContainer.resetHeight;

	
	if(config == null){
		config = { };	
	}	

	if(config.autosize == null){
		config.autosize = "true";
	}

	if(config.selectedId == null){
		config.selectedId = 0;
	}

	if(config.panelSelector == null){
		config.panelSelector = ".tabPanel";
	}

	if(config.headerSelector == null){
		config.headerSelector = "h4";
	}

	if(config.contentSelector == null){
		config.contentSelector = ".tabContent";
	}

	$("#"+id).show();
	$("#"+id).addClass("horzTabs");
	$("#"+id).addClass("tabbox");
	
	$("#"+id+" "+config.panelSelector).each(function (){		
		var tab = new Tab(i, $(this), $(this).find(config.headerSelector), $(this).find(config.contentSelector));

		$(tab.header).find("a").bind("click", function(e){			
			obj.select(tab.id, e);
		});
		
		$(tab.header).find("a").bind("focus", function(e){
			obj.select(tab.id, e);
		});

		tab.unselect();	
				
		obj.tabs[i] = tab;
		
		i++;
	});



	this.selectedId = config.selectedId;
	this.select(this.selectedId);
	this.config = config;
	this.resetHeight();
/*
	var header = $("#"+this.id +" " + this.config.headerSelector);
	var totalHeight = header.height();
	totalHeight += parseInt(header.css("padding-bottom"), 10) + parseInt(header.css("padding-top"), 10); //Total Padding height
	totalHeight += parseInt(header.css("margin-bottom"), 10) + parseInt(header.css("margin-top"), 10); //Total Margin height
	totalHeight += parseInt(header.css("borderBottomWidth"), 10) + parseInt(header.css("borderTopWidth"), 10); //Total Border height

	var content = $("#"+this.id +" " +this.config.contentSelector);
	totalHeight += content.height();
	totalHeight += parseInt(content.css("padding-bottom"), 10) + parseInt(content.css("padding-top"), 10); //Total Padding height
	totalHeight += parseInt(content.css("margin-bottom"), 10) + parseInt(content.css("margin-top"), 10); //Total Margin height
	totalHeight += parseInt(content.css("borderBottomWidth"), 10) + parseInt(content.css("borderTopWidth"), 10); //Total Border height

	$("#"+id).css("height", totalHeight);
*/
	return this;
}

TabContainer.select = function(index, evt){
	// Prevent default event action
	if(evt){
		if (evt.preventDefault) {
			evt.preventDefault();
		} 
		else {
			evt.returnValue = false;
		}
	}
	
	this.tabs[this.selectedId].unselect();
	this.selectedId = index;
	this.tabs[this.selectedId].select();
	this.resetHeight();
}

TabContainer.resetHeight = function(){
	$("#"+this.id).css("height", this.height());

}

TabContainer.height = function(){
	var header = $(this.tabs[this.selectedId].header);
	var totalHeight = header.height();
	totalHeight += parseInt(header.css("padding-bottom"), 10) + parseInt(header.css("padding-top"), 10); //Total Padding height
	totalHeight += parseInt(header.css("margin-bottom"), 10) + parseInt(header.css("margin-top"), 10); //Total Margin height
	totalHeight += parseInt(header.css("borderBottomWidth"), 10) + parseInt(header.css("borderTopWidth"), 10); //Total Border height

	var content = $(this.tabs[this.selectedId].content);
	totalHeight += content.height();
	totalHeight += parseInt(content.css("padding-bottom"), 10) + parseInt(content.css("padding-top"), 10); //Total Padding height
	totalHeight += parseInt(content.css("margin-bottom"), 10) + parseInt(content.css("margin-top"), 10); //Total Margin height
	totalHeight += parseInt(content.css("borderBottomWidth"), 10) + parseInt(content.css("borderTopWidth"), 10); //Total Border height


	return totalHeight;
}

// Tab
Tab = function(id, panelElement, headerElement, contentElement){
	this.panel = panelElement;
	this.header = headerElement;
	this.content = contentElement;
	this.id = id;
	
	// functions
	this.select = Tab.select;
	this.unselect = Tab.unselect;

}

Tab.select = function(){
	$(this.panel).addClass("selected");
	$(this.content).show();	
}

Tab.unselect = function(){
	$(this.panel).removeClass("selected");
	$(this.content).hide();
}

/*Tabboxes end*/

/*default height setting*/

function setHeightUIU(){

}

/*end default height settings*/

//clear default input value
function clearDefault(element) {

	element.focus( function(){
		// Assign $(this) to a variable, allowing DOM to do less lookup
		var el = $(this);
		var val = el.val();
		
		// Using jQuery data object, check to see if value has been 
		// assigned to placeholder data object and if not it should be assigned a value.
		if (!el.data('placeholder')) {
			el.data('placeholder', val);
		}
		
		if(val == el.data('placeholder')) {
			el.val('');
		}
	});
	
	// Execute when user leaves the input field
	element.blur( function () {
		// Assign $(this) to a variable, allowing DOM to do less lookup
		var el = $(this);
		if (el.val() == '') {
			el.val(el.data('placeholder') || '');
		}
	});
}

addLoadEvent(function(){
	alternate_init();
	clearDefault($(".clear_defaults"));

	textResize();

	roundAllAndEqualHeight('div#rounded div.ui-u');
        if($('div.info-box'))
		$('div.info-box').each(roundLegacyInfoElement);
	if($('div.info-go'))
    		$('div.info-go').each(roundLegacyInfoElement);
	if($('div.info-yellow'))
    		$('div.info-yellow').each(roundLegacyInfoElement);
	if($('div.info-stop'))
    	$('div.info-stop').each(roundLegacyInfoElement);
});

