// JQuery goodness
/*$(function() {
	// Disable right-click
	$('img').bind("contextmenu", function() { return false; });
});

sfHover = function() {
	var sfEls = document.getElementById("sucker").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

function popitup(theURL,theHeight,theWidth)
{
	if( isNaN(theHeight) )		theHeight = 400;
	if( isNaN(theWidth) )		theWidth = 200;
	
	newwindow=window.open(theURL,'popUp','height='+theHeight+',width='+theWidth);
	if (window.focus) {newwindow.focus()}
}
*/
function resetImgs() {
	$('#gallery_thumbs a').removeClass();
}

function showImg(filename,id,caption,gallery) {
	var path = "http://paxtonpark.co.nz/images/gallery";
	if (gallery != null) path += "-" + gallery;
	path += "/large/" + filename;
	resetImgs();
	$('#'+id).addClass("sel");
	$('#gallery_large img').attr("src",path);
	$('#caption').html( caption );

}

function updateContract() {
	$('.contract_name').html($('#name').val() ? $('#name').val() : '...');
	$('.contract_mare').html($('#mare-name').val() ? $('#mare-name').val() : '...');
	$('.contract_stallion').html($('#stallion').val() ? $('#stallion').val() : '...');
	
	var price = 5000;
	$('.contract').hide();
	$('#gorky-contract-select').hide().prev().hide();
	$('#gorky-service-select').hide().prev().hide();
	if ($('#stallion').val() == 'Shinko King') {
		price = 5500;
		$('#contract').show();
		$('#gorky-contract-select').val('-');
		$('#gorky-service-select').val('-');
	}
	else if ($('#stallion').val() == 'Gorky Park') {
		$('#gorky-contract-select').show().prev().show();
		if ($('#gorky-contract-select').val() == 'service') {
			$('#contract').show();
			$('#gorky-service-select').show().prev().show();
            if ($('#gorky-service-select').val() == "-") {
                price = "...";
            } else {
                price = $('#gorky-service-select').val().substring(1);
            }
		} else if ($('#gorky-contract-select').val() == 'alternative') {
			$('#contract2').show();
			$('#gorky-service-select').val('-');
		}
	}
	else if ($('#stallion').val() == 'Prince Conti') {
		price = 2500;
		$('#contract').show();
		$('#gorky-contract-select').val('-');
		$('#gorky-service-select').val('-');
	}
	
	$('.contract_price').html(price);
	$('.contract_price2').html(price);
}
