// JavaScript Document

function changePic(optionid, id){
	//div, url, options
	new Ajax.Updater('myphoto', 'product_detail_aj.cfm?optionid=' + optionid + '&id=' + id, {asynchronous:true, evalScripts:true});
setTimeout( "changeOption("+optionid+", "+id+");", 500); 
}

function changeOption(optionid, id){
	//div, url, options
	new Ajax.Updater('size_options', 'product_detail_sizes_aj.cfm?optionid=' + optionid + '&id=' + id, {asynchronous:true, evalScripts:true});
}


function add_to_cart(){
	var data = $('product_detail').serialize()	
	var url = 'cart_insert_do_aj.cfm?'+data;
	
	new Ajax.Request(url, {
	  method: 'get',
	  onSuccess: create_timeout(1500, "show_cart()")
	});
}

 /* @author paul
 */
function send_msg_to_friend(post){
	if(validate_form('sender_name|sender_email|friends_email|message','send_to_friend_frm',false)){
		
		new Ajax.Request('aj_send_mail.cfm?'+post+'&subject=Your friend thought you may like this', 
		{asynchronous:true, 
			onSuccess:function(){alert('done')},
			onFailure: function(){ alert('Something went wrong...') }
						 });
//		window.location ='core/aj_send_mail.cfm?' + post
	}
	
}

