function myInit() {
		
	$('#footer > ul > li:last').addClass('last');	
	
	$('ul#productImages > li > a > img').click( function() {		
		
		$('ul#productImages li').removeClass('selected');
		$(this).parent().parent().addClass('selected');
		imageId = this.id;		
		imageId = imageId.replace('thumb_','');		
		loadImage(imageId);
		return false;
		});
	/*
	$('#productDetail #details input.addToBasket').hover( function () {				
		$(this).addClass("addToBasketOn");
		},function () {	
		$(this).removeClass("addToBasketOn");
		}
		);
	$('#basket input.updateBasket').hover( function () {				
		$(this).addClass("updateBasketOn");
		},function () {	
		$(this).removeClass("updateBasketOn");
		}
		);
	$('#basket input.payNow').hover( function () {				
		$(this).addClass("payNowOn");
		},function () {	
		$(this).removeClass("payNowOn");
		}
		);
	*/
	$('#countrySelect').change( function() {				
		var countryId = $('#countrySelect').val();
		$.ajax({
			type: "POST",
			url: "/shippingPrice.php",
			data: "country="+countryId,
			success: function(returned){
				myData = returned.split("|");
				$('#shippingRate').html(myData[0]);										
				$('#totalPrice').html(myData[1]);										
				}
			});		
		});
	
	if ($('.pageMedia').length == 0) {
		$('.pageContent').css("margin","0");
		}
	if ($('.postMedia').length == 0) {
		$('.postContent').css("margin","0");
		}
	
	$('#header form').submit( function() {	
		
		email = $('#subscriberEmail').val();
		
		if (email == '' || email == 'Your email') {
			alert("Please enter your email address");
			return false;
			}
		$.ajax({
			type: "POST",
			url: "/signup.php",
			data: "email="+email,
			success: function(returned){					
				$("#subscriberForm").html("<p>Thank you for subscribing</p>");
				}
			});				
		return false;	
		});
	
	


	}

function goback() {
	history.back();
	}


function loadImage(imageId) {	
	if (!imageId) {
		return;
		}
		
	$('#mainImage').fadeOut(200, function () {		
		$.ajax({
			type: "POST",
			url: "/loadImage.php",
			data: "im="+imageId,
			success: function(returned){	
								
				$('#mainImage').html(returned);			
				$('#mainImage').fadeIn(200, function () {						
					});				
				}
			});			
		});	
	}

