function getFormObject(objectName){return document.forms[objectName];};
function getHTMLObject(objectName){return document.getElementById(objectName);};
function hideItem(theItem){getHTMLObject(theItem).style.display	= "none";};
function showItem(theItem){getHTMLObject(theItem).style.display	= "block";};
function toggleShowItem(theItem){
	if(getHTMLObject(theItem).style.display	== "block"){
		getHTMLObject(theItem).style.display	= "none";
	}else{
		getHTMLObject(theItem).style.display	= "block";	
	}
};
function setBookmark(url,title){
	if(document.all){
		window.external.AddFavorite(url, title);
	}
	else if(window.sidebar){
		window.sidebar.addPanel(title, url, "");
	}
	else if(window.print && window.opera){
		var bmLink = document.createElement('a');
		bmLink.setAttribute('href',url);
		bmLink.setAttribute('title',title);
		bmLink.setAttribute('rel','sidebar');
		bmLink.click();
	} 
	else{
		if(editionLCID==1053){
			alert("Vi saknar tyvärr direktlänk för att lägga till bokmärket i den webbläsare du använder.");	
		}else{
			alert("Unfortunatly we were not able to add the bookmark directly to the browser you are using.");	
		}
	}
}
var captchaField 		= "";
var captchaForm			= "";
var captchaFormTrigger 	= "";
var captchaFormMessage	= "";
var captchaValidField	= "";

function validateCaptchaInput(formTrigger){
	
	var hiddenVal 	= captchaForm.find("#captchaRandom").val();
	var inputVal 	= captchaField.val();
	var indicator	= captchaForm.find(".capthcaCheck");

	indicator.css({"background-image" : "url(http://www.smode-resource.se/gfx/icons/ajax-loader.gif)"});

	if(captchaValidField.val()==1){
		return captchaOk();
	}else{
		if(inputVal.length==4){
			$.ajax({
			  type: "GET",
			  url: "/core/coreSrc/modules/captcha/ajax-validate.asp",
			  data: "inputVal="+inputVal+"&hiddenVal="+hiddenVal,
			  contentType: "text/html; charset=iso-8859-1",
			  error : function(data,string) {alert(string);},
			  success : function (data) {
				  var theResult = Math.floor(data);
				  if(theResult==-1){
					  indicator.css({"background-image" : "url(http://www.smode-resource.se/gfx/icons/check.gif)"});
					  return captchaOk();
					}else{
					  indicator.css({"background-image" : "url(http://www.smode-resource.se/gfx/icons/action_refresh.gif)"});
					 return captchaInvalid();
				  }
				}
			});
		}else{
			  indicator.css({"background-image" : "url(http://www.smode-resource.se/gfx/icons/action_refresh.gif)"});
			return captchaInvalid();
		}
	}
}
function captchaOk(){
	 captchaField.removeClass("swlValidationError");
	 captchaField.addClass("swlValidationOk");
	 captchaValidField.val("1");
	 captchaField.attr("disabled","disabled");
	 captchaShowSubmit();
	 return true;
}
function captchaInvalid(){
	 captchaField.removeClass("swlValidationOk");
	 captchaField.addClass("swlValidationError");
	 captchaValidField.val("0");
	 captchaHideSubmit();
	return false;
}
function captchaHideSubmit(){
	 captchaFormTrigger.after(captchaFormMessage);
	 captchaFormTrigger.hide();
}
function captchaShowSubmit(){
	 captchaFormMessage.remove();
	 captchaFormTrigger.show();
}
function removeGenericConfirm(theURL,theMessage){
	if(confirm(theMessage)){
		document.location=theURL;
	}
}
function ajaxRenewSession(){
	if($(".ajaxRenewLoginSession").is('*')){
		var theKey		= $(".ajaxRenewLoginSession > .key").text();
		var theRandom	= $(".ajaxRenewLoginSession > .rnd").text();
		var theSalt		= $(".ajaxRenewLoginSession > .salt").text();
		var theDate		= $(".ajaxRenewLoginSession > .dte").text();
	   $(".ajaxRenewLoginSession").load("/core/coreSrc/ajax/renew-session.asp",{randomInt : theRandom, keyStr : theKey, saltInt : theSalt, timeDate: theDate}, function(){});
	   setTimeout('ajaxRenewSession()',120000);
	}
}
function hideSystemMessage(){
	if($("div.systemMessageBox").is('*')){
	   $("div.systemMessageBox").fadeOut('slow');
	}
}
function clockSystemMessage2010(){
	var delayBox = $(".system-message-container").find(".delay");
	var newDelay = Math.floor(delayBox.html())-1;
	
	var doCount	 = !$(".pause-delay").is("*");
	if(newDelay > 0 && doCount){
		delayBox.html(newDelay);
		setTimeout('clockSystemMessage2010()',1000);
	}else{
		if(doCount){
			$(".system-message-container").fadeOut("slow");	
		}else{

		}
	}
}
function userAutoCompleteFill(tempName,tempId,destinationField,valueField){
	$("input#"+destinationField).val(tempId);
	$("input#"+valueField).val(tempName);
	$("div#autoComplete"+destinationField).slideUp("slow");
}
