/***********************************************
* jQuery functions execute
***********************************************/

//Cufon
Cufon.replace('h1, #homeTitle, #prod-title, #event-title, #nav-home, #nav-about, #nav-jewellery, #nav-jclub, #nav-events, #nav-contact'); 

//bookmark function
function bookmarksite(title,url){
	if (window.sidebar) 
		window.sidebar.addPanel(title, url, "");
	else if(window.opera && window.print){ 
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	} else if(document.all)
		window.external.AddFavorite(url, title);
	}

	jQuery(document).ready(function(){ 
	/*external link*/
	$('a[rel*=external]').click( function(){this.target = "_blank";});
	
	/*set hover class for anything*/
	$('form.cmxform input.send').css('cursor', 'pointer').hover(function() {$(this).addClass('inputhover');}, function() {$(this).removeClass('inputhover');});	
	});

/***********************************************
* Form fields Validation Script - sample validation
***********************************************/

function ValidateForm(f){
	with(f){
		if (isEmpty(fullname.value)) {alert("Please enter your Name");fullname.focus();return false;}
		if (isEmpty(phone.value)) {alert("Please enter your Phone Number");phone.focus();return false;}
		if (isEmpty(email.value)) {alert("Please enter your Email Address");email.focus();return false;}
		if (!isEmail(email.value) ) {alert("Please enter a valid Email Address."); email.focus();return false;}
		if (isEmpty(enquiries.value)) {alert("Please enter your Enquiry");enquiries.focus();return false;}
	}
	return true;
 }
 
 function ValidateForm2(f){
	with(f){
		if (isEmpty(fullname.value)) {alert("Please enter your Name");fullname.focus();return false;}
		if (isEmpty(email.value)) {alert("Please enter your Email Address");email.focus();return false;}
		if (!isEmail(email.value) ) {alert("Please enter a valid Email Address."); email.focus();return false;}
	}
	return true;
 }
 
 // Nivo Slider Init
 $(window).load(function() {
        $('#slider').nivoSlider({
			effect:'fade',
			slices:15,
			animSpeed:600, //Slide transition speed
			pauseTime:5000,
			startSlide:0, //Set starting Slide (0 index)
			directionNav:false, //Next & Prev
			directionNavHide:false, //Only show on hover
			controlNav:false, //1,2,3...
			controlNavThumbs:false, //Use thumbnails for Control Nav
			controlNavThumbsFromRel:false, //Use image rel for thumbs
			controlNavThumbsSearch: '.jpg', //Replace this with...
			controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
			keyboardNav:false, //Use left & right arrows
			pauseOnHover:false, //Stop animation while hovering
			manualAdvance:false, //Force manual transitions
			captionOpacity:0.8, //Universal caption opacity
			beforeChange: function(){},
			afterChange: function(){},
			slideshowEnd: function(){}, //Triggers after all slides have been shown
			lastSlide: function(){}, //Triggers when last slide is shown
			afterLoad: function(){} //Triggers when slider has loaded
						  
		});
    });

