<!-- hämtar ett objekt givet ett id för olika browsers -->
if( document.getElementById ) {
	getElemById = function(objId) {
		return document.getElementById(objId);
	}
} else if( document.all ) {
	getElemById = function(objId) {
		return document.all[objId];
	}
} else if( document.layers ) {
	getElemById = function(objId) {
		return document.layers[objId];
	}
}


<!-- ändrar objektet "id":s klasstillhörighet -->
function classChange(id, newClass) {
	eval("getElemById('" + id + "').className='" + newClass + "'");
}

<!-- aktiverar valt menyalternativ -->
function activateMenu(id) {
	eval("classChange('menu" + id + "','active')");
}

<!-- aktiverar valt submenyalternativ -->
function activateSubMenu(id) {
	eval("classChange('submenu" + id + "','active')");
}

function chooseCSS() {
	if (screen.width >= 1024) {
		document.body.style.backgroundImage = "url(images/bg_left.gif)";
		document.body.style.marginLeft = "55px";
	}
}

<!-- laddar ny sida -->
var activePage = 1;
function loadPage(pageIdx,pageType) {
	$(".chappic img").attr('src', 'images/'+pageType+'-page-'+pageIdx+'.jpg');
	var src = $("#img"+pageIdx).attr('src');
	$("#img"+pageIdx).unbind().attr('src', src.replace("-off","-on"));
	src = $("#img"+activePage).attr('src');
	$("#img"+activePage).hover(
		function(){this.src = this.src.replace("-off","-on");},
        function(){this.src = this.src.replace("-on","-off");}).attr('src',src.replace("-on","-off"));
	activePage = pageIdx;
	
	
/*
	$(".chappic img").fadeOut('fast');
	$(".geninfo").fadeOut('fast').load('incfiles/'+pageType+'/'+pageType+'-page-'+pageIdx+'.php', function() {
		$(".geninfo").fadeIn('fast');
		$(".chappic img").attr('src', 'images/'+pageType+'-page-'+pageIdx+'.jpg').fadeIn('fast');
		var src = $("#img"+pageIdx).attr('src');
		$("#img"+pageIdx).unbind().attr('src', src.replace("-off","-on"));
		src = $("#img"+activePage).attr('src');
		$("#img"+activePage).hover(
								   function(){this.src = this.src.replace("-off","-on");},
          						   function(){this.src = this.src.replace("-on","-off");}).attr('src',src.replace("-on","-off"));
		activePage = pageIdx;
	}); */
}


<!--  bildswapparfunktion -->
jQuery(function(){
     $(".imgswap").hover(
          function(){this.src = this.src.replace("-off","-on");},
          function(){this.src = this.src.replace("-on","-off");
     });
});

<!-- Prisberäkning via ajax -->
function updatePrice() {
	var LCS = $("#LCsoftcover").val();
	var DSS = $("#DSsoftcover").val();
	var DSH = $("#DShardcover").val();
	var region = $("#region").val();
	$("#sum").val(0);
	$.getJSON('incfiles/calculateprice.php', { LCS: LCS, DSS: DSS, DSH: DSH, region: region }, function(data) {
		$("#LCsoftcoverRow .item").empty().append(data.LCSno);
		$("#LCsoftcoverRow .currency").empty().append(data.Currency);
		$("#LCsoftcoverRow .price").empty().append(data.LCS);
		
		$("#DSsoftcoverRow .item").empty().append(data.DSSno);
		$("#DSsoftcoverRow .price").empty().append(data.DSS);
		$("#DSsoftcoverRow .currency").empty().append(data.Currency);
		
		$("#DShardcoverRow .item").empty().append(data.DSHno);
		$("#DShardcoverRow .price").empty().append(data.DSH);
		$("#DShardcoverRow .currency").empty().append(data.Currency);
		
		$("#shippingRow .price").empty().append(data.Shipping);
		$("#shippingRow .currency").empty().append(data.Currency);
		
		$("#discountRow .price").empty().append('-'+data.Discount);
		$("#discountRow .currency").empty().append(data.Currency);
		
		$("#sumRow .price").empty().append(data.Total);
		$("#sumRow .currency").empty().append(data.Currency);
		$("#sum").val(data.Totalsum);
		if (data.Totalsum=='' || data.Totalsum==0 || data.Totalsum=='0') {
			$("#submitbutton").attr("src", "images/BUTTON-proceed_inactive.jpg");
		} else {
			$("#submitbutton").attr("src", "images/BUTTON-proceed.jpg");	
		}
		
	});
	
}

<!-- Kontrollera att prisberäkningen är klar -->
function checkIfReady() { 
	if ($("#region").val() == "") 
		alert('You must choose region to proceed to checkout');
	else if ($('#sum').val() > 0) 
		$('#orderform').submit(); 
	else if ($("#LCsoftcover").val() == 0 && $("#DSsoftcover").val() == 0 && $("#DShardcover").val() == 0)
		alert('You must order at least one bok to proceed to checkout');
	else 
		alert('Please wait until the price has been calculated');
}
