
function show_intro_image() {
	
	var intro_image = document.getElementById('shop_intro_image');
	
	if (intro_image != null) {
		show_image(intro_image.getAttribute('src'), getDimensions(intro_image)['width'], getDimensions(intro_image)['height']);
	}
}

function show_image(image_url, width, height) {
	
	if (image_url == null || image_url == '')
		return;
	
	var element = document.getElementById('right_content');
	element.innerHTML = '';
	
	var image = document.createElement('img');
	document.getElementById('right_content').appendChild(image);
	
	image.setAttribute('src', image_url);
	
	image.style.display = 'block';
	
	var final_width = 0;
	var final_height = 0;
		
	var heightRatio = height / getDimensions(element).height;
	var widthRatio = width / getDimensions(element).width;
								
	if (heightRatio > widthRatio) {
					
		if (height < getDimensions(element).height) {
			image.style.height = height + 'px';
			image.style.width = width + 'px';
						
			image.style.top = ((getDimensions(element).height - height) / 2) + 'px';	
		} else {
			image.style.height = getDimensions(element).height + 'px';
			image.style.width = (width / heightRatio) + 'px';
		}
					
	} else {
		
		if (widthRatio == 0) widthRatio = 0.001;
		
		var newHeight = height / widthRatio;
					
		if (width < getDimensions(element).width) {
			image.style.height = newHeight + 'px';
			image.style.width = width + 'px';
		} else {			
			image.style.height = newHeight + 'px';
			image.style.width = getDimensions(element).width + 'px';
		}
				
		image.style.top = (getDimensions(element).height / 2 - newHeight / 2) + 'px';
	}
}

function getDimensions(element) {
    element = $(element);
    var display = $(element).style.display;
    if (display != 'none' && display != null) // Safari bug
      return {width: element.offsetWidth, height: element.offsetHeight};

    // All *Width and *Height properties give 0 on elements with display none,
    // so enable the element temporarily
    var els = element.style;
    var originalVisibility = els.visibility;
    var originalPosition = els.position;
    var originalDisplay = els.display;
    els.visibility = 'hidden';
    els.position = 'absolute';
    els.display = 'block';
    var originalWidth = element.clientWidth;
    var originalHeight = element.clientHeight;
    els.display = originalDisplay;
    els.position = originalPosition;
    els.visibility = originalVisibility;
    return {width: originalWidth, height: originalHeight};
}

	<!-- GET VALUES FOR QUANTITY and PRODUCT CODE -->
		function SubmitItem(formname) { 
			//var colourvalue = formname.colour.value; //get colour 
			//var sizevalue = formname.size.value; //get size 
			var ProductCode = formname.productcode.value; //get productcode 
			var quantityvalue = formname.quantity.value; //get quantity 
			if (quantityvalue == '') {
				quantityvalue = 1;
			}
			//if (!colourvalue) { 
			//alert('Please select a colour.');
			// return false; 
			// } 
			// if (!sizevalue) {
			// alert('Please select a size.'); 
			// return false;
			// } 
			var url ="http://FFD.amplifier.co.nz/addtobasket.do?" + "id=" + ProductCode + "&quantity" + "=" + quantityvalue;
			// "&custName" + ProductCode + "=SIZE&custvalue" + ProductCode + "=" + sizevalue + 
			// "&custName" + ProductCode + "=COLOUR&custvalue" + ProductCode + "=" + colourvalue +
			
			// <!-- "&custName" + ProductCode + "=QUANTITY&custvalue" + ProductCode + "=" + quantityvalue;-->
			
			//alert(url);
			//this.location.href = url;
			OpenWindowForPurchase(url);
		}
		<!-- GET VALUES FOR QUANTITY and PRODUCT CODE -->
		function SubmitThreadItem(formname) { 
		 //alert("go");
		 var colourvalue = formname.colour.value; //get colour 
		 var sizevalue = formname.size.value; //get size 
		 var ProductCode = formname.productcode.value; //get productcode 
		 var quantityvalue = formname.quantity.value; //get quantity 
		 if (quantityvalue == '') {
		 quantityvalue = 1;
		 } 
		 if (!colourvalue) { 
			alert('Please select a colour.');
		 return false; 
		 } 
		 if (!sizevalue) {
		 	alert('Please select a size.'); 
		 return false;
		 } 
		
		
		 var url = 
		 "http://FFD.amplifier.co.nz/addtobasket.do?" + 
		 "id=" + ProductCode + 
		 "&custName" + ProductCode + "=SIZE&custValue" + ProductCode + "=" + sizevalue + 
		 "&custName" + ProductCode + "=COLOUR&custValue" + ProductCode + "=" + colourvalue +
		<!-- "&custName" + ProductCode + "=QUANTITY&custValue" + ProductCode + "=" + quantityvalue;-->
		 "&quantity" + "=" + quantityvalue;
		// alert(url);
		// this.location.href = url;
		OpenWindowForPurchase(url);
		}
		
		<!-- OPEN WINDOW FOR PURCHASE -->
		function OpenWindowForPurchase(url){
 			var w = 420;
 			var h = 600;
			PU(url, w, h, 'purchase',true,false,false,false,false);
			return true;
		}
		<!-- SET FEATURES FOR PURCHASE WINDOW -->
		function PU (url,x,y,name,sb,rs,st,lt,tb) {
			var win = null;
			var scrollbarstext = 'scrollbars = yes,';
			var resizabletext = 'resizable = yes,';
			var statustext = 'status = no,';
			var locationtext = 'location = no,';
			var toolbartext = 'toolbar = no,';
			var features = '';
			if (sb == 1){scrollbarstext = 'scrollbars = yes,'}
			if (rs == 1){resizabletext = 'resizable = yes,'}
			if (st == 1){statustext = 'status = yes,'}
			if (lt == 1){locationtext = 'location = yes,'}
			if (tb == 1){toolbartext = 'toolbar = yes,'}
			features = scrollbarstext+resizabletext+statustext;
			features = features + locationtext+toolbartext;
			features = features + 'width = '+x+',height = '+y;
			win = window.open(url, name, features);
			return true;
		}
