$(function(){
	/* 
		SUPERSIZE BACKGROUND
		Allow the background to be stretch along with the browser size
		and resize the image to fix the browser resolution.
	*/
	$.fn.supersized.options = {  
		startwidth: 1800,  
		startheight: 1150,
		vertical_center: 1,
		slideshow: 0,
		navigation: 0,
		transition: 0, //0-None, 1-Fade, 2-slide top, 3-slide right, 4-slide bottom, 5-slide left
		pause_hover: 0,
		slide_counter: 0,
		slide_captions: 0,
		slide_interval: 0  
	};
	$('#supersize').supersized(); 
});

$(document).ready(function(){

	//toggle the componenet with class msg_body
	$(".show_news").click(function(){
		$(".newsletter_wrap").slideToggle(600);
	});

	$(".close_box").click(function(){
		$(".newsletter_wrap").slideUp(600);
	});

	/* 
		NEWSLETTER 
		Inserts labels into the input fields, and then removed them upon click
		Used in sidebar.tpl
	*/
	/*
	$('#StoreSubscriberFirstName').val('First Name');
	$('#StoreSubscriberLastName').val('Last Name');
	$('#StoreSubscriberEmail').val('Email');
	
	$('#StoreSubscriberFirstName').focus(function() {
		if ($('#StoreSubscriberFirstName').val() == 'First Name') {
			$('#StoreSubscriberFirstName').val('');
		}
	});
	
	$('#StoreSubscriberFirstName').blur(function() {
		if ($('#StoreSubscriberFirstName').val() == '') {
			$('#StoreSubscriberFirstName').val('First Name');
		}
	});
	
	$('#StoreSubscriberLastName').focus(function() {
		if ($('#StoreSubscriberLastName').val() == 'Last Name') {
			$('#StoreSubscriberLastName').val('');
		}
	});
	
	$('#StoreSubscriberLastName').blur(function() {
		if ($('#StoreSubscriberLastName').val() == '') {
			$('#StoreSubscriberLastName').val('Last Name');
		}
	});
	
	$('#StoreSubscriberEmail').focus(function() {
		if ($('#StoreSubscriberEmail').val() == 'Email') {
			$('#StoreSubscriberEmail').val('');
		}
	});
	
	$('#StoreSubscriberEmail').blur(function() {
		if ($('#StoreSubscriberEmail').val() == '') {
			$('#StoreSubscriberEmail').val('Email');
		}
	});
	*/
	
	/* 
		DESIGNERS
		Used in designers/index.tpl 
	*/
	$("#designers").easySlider();
	
	
	/* 
		PAGINATION 
		Used in designers/view.tpl, press/index.tpl, press/view.tpl,
		store/catalogue.tpl, store/view.tpl
	*/
	$("#thumbView").easySlider();
	
	/*
		FANCY BOX
		Used in press/view.tpl and store/view.tpl
	*/
	$("a#single_image").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': true, 'overlayOpacity': 0.7 });
	$("a.fancybox_item").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': true, 'overlayOpacity': 0.7 });
	
	/*
		FANCY BOX - iFrame
		Used to display the contact form in a iFrame
	*/
	$("a.iframe").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'frameWidth': 550, 'frameHeight': 270, 'overlayShow': true });

});


function display_img(thumb_src, full_src, target, index) {
	/*
	$('.altimg').attr({
		"class" : "altimg"
	});
	$('#alt_img_' + index).attr({
		"class" : "altimg active"
	});
	*/
	$('#' + target + ' > a').attr({
		"href" : full_src
	});
	$('#' + target + ' > a > img').attr({
		"src" : thumb_src
	});
}


function ucc_submit() {
	if ($('#uccTo').val() != '') {
		$('#ucc_form').submit();
	}
}


function ucc_toggle() {
	$('#uccTo').val('');
	$('#uccToDiv').toggle('fast');
}
