// <![CDATA[
$(function() {

  // Slider
  $('#coin-slider').coinslider({width:916,height:280,opacity:1,delay:5000,sDelay:50});

  // Radius Box
  $('p.infopost').css({"border-radius":"6px", "-moz-border-radius":"6px", "-webkit-border-radius":"6px"});
  //$('.content .sidebar .gadget, .fbg_resize').css({"border-radius":"12px", "-moz-border-radius":"12px", "-webkit-border-radius":"12px"});
  //$('.content p.pages span, .content p.pages a').css({"border-radius":"16px", "-moz-border-radius":"16px", "-webkit-border-radius":"16px"});
  //$('.menu_nav').css({"border-bottom-left-radius":"16px", "border-bottom-right-radius":"16px", "-moz-border-radius-bottomleft":"16px", "-moz-border-radius-bottomright":"16px", "-webkit-border-bottom-left-radius":"16px", "-webkit-border-bottom-right-radius":"16px"});

});	

$(function() {


	// Dialog			
	$('#dialog').dialog({
		autoOpen: false,
		width: 600,
		buttons: { "Ok": function() { $(this).dialog("Close"); }, "Cancel": function() { $(this).dialog("Close"); } }
	});
	
	// Dialog Link
	$('#dialog_link').click(function(){
		$('#dialog').dialog('open');
		return false;
	});
	
	//hover states on the static widgets
	$('#dialog_link, ul#icons li').hover(
		function() { $(this).addClass('ui-state-hover'); }, 
		function() { $(this).removeClass('ui-state-hover'); }
	);
	
});

// ]]>

function checkEmail(myForm) {
	if	(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myForm.email.value)){
		return (true);
	}
	alert("Invalid E-mail Address! \n Please re-enter.")
	return (false);
}



function UpdateCustomer(formName) {
	var fIsOK = new Boolean('false');
	for (i=0;i<formName.elements.length ;i++) {
		box = formName.elements[i];
		if (box.type && box.type.toLowerCase().substring(0,4)=="text") {
			//alert(box.name);
			if (!box.value){
				alert('Customer: ' + box.name + '!');
				formName.focus();
				fIsOK==false;
				return false;
			} else {fIsOK==true;}
		}
	}
	if (fIsOK==true) { formName.submit(); return true; }
}


/* ---------------------------- */
/* XMLHTTPRequest Enable */
/* ---------------------------- */
function createObject() {
var request_type;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
request_type = new ActiveXObject("Microsoft.XMLHTTP");
}else{
request_type = new XMLHttpRequest();
}
return request_type;
}


/* --  Store: Add Items -- */

var http = createObject();
var nocache = 0;


function Basket(cAction,nProductID,nQuantity) {

document.getElementById('CustomersCart').innerHTML = "Loading..."
nocache = Math.random();
http.open('get', '/store/WebCartItems.cfm?Action='+cAction+'&ProductID='+nProductID+'&Quantity='+nQuantity+'&nocache = '+nocache+'&rnd='+Math.floor(Math.random()*100000));
http.onreadystatechange = refreshCart;
http.send(null);
}

function refreshCart() {
if(http.readyState == 4){ 
var response = http.responseText;
if(response == 0){
document.getElementById('CustomersCart').innerHTML = 'Loading...';
} else {
document.getElementById('CustomersCart').innerHTML = response;
}
}
}

