// JavaScript Document
jQuery(document).ready(function(){
		
		jQuery("#colour_click").click(function() {
	 	
			jQuery('#tab_details').hide();
			jQuery('#tab_sizes').hide();
			jQuery('#tab_colours').fadeIn();
			jQuery('#details_button').attr('class','offtab');
			jQuery('#sizes_button').attr('class','offtabmid');
			jQuery('#colours_button').attr('class','ontab');
			
			return false;
			
		});
		
		jQuery("#details_button").click(function() {
	 	
			jQuery('#tab_colours').hide();
			jQuery('#tab_sizes').hide();
			jQuery('#tab_details').fadeIn();
			jQuery('#details_button').attr('class','ontab');
			jQuery('#sizes_button').attr('class','offtabmid');
			jQuery('#colours_button').attr('class','offtab');
			return false;
			
		});
		
		jQuery("#colours_button").click(function() {
	 	
			jQuery('#tab_details').hide();
			jQuery('#tab_sizes').hide();
			jQuery('#tab_colours').fadeIn();
			jQuery('#details_button').attr('class','offtab');
			jQuery('#sizes_button').attr('class','offtabmid');
			jQuery('#colours_button').attr('class','ontab');
			return false;
			
		});
		
		jQuery("#sizes_button").click(function() {
	 	
			jQuery('#tab_details').hide();
			jQuery('#tab_colours').hide();
			jQuery('#tab_sizes').fadeIn();
			jQuery('#details_button').attr('class','offtab');
			jQuery('#sizes_button').attr('class','ontabmid');
			jQuery('#colours_button').attr('class','offtab');
			return false;
			
		});
		
		jQuery(".jqzoom").jqueryzoom({
			xzoom: 457, //zooming div default width(default width value is 200)
			yzoom: 335, //zooming div default width(default height value is 200)
			offset: 10, //zooming div default offset(default offset value is 10)
			position: "right", //zooming div position(default position value is "right")
			preload:1, // by default preload of big images is 1
			lens:1 // by default the lens is 1
		});

	});

function CheckOptions() {
	if (document.product_form.colour.value=="") {
  	alert("Please choose a colour");
  	return false;
  } else if (document.product_form.size.value=="") {
  	alert("Please choose a size");
  	return false;
	}
}

var xmlhttp;

function getSizes(colour,product_id)
{
	xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }
var url="/get-sizes.php";
url=url+"?c="+colour;
url=url+"&p="+product_id;
url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function stateChanged()
{
if (xmlhttp.readyState==4)
{
document.getElementById("size-drop").innerHTML=xmlhttp.responseText;
}
}

function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}
