$(document).ready(function() {
    $("dd").mouseover(function(){
                $(this).css({ border: "1px solid blue"});
	});
        $("dd").mouseout(function(){
                $(this).css({ border: "1px solid #cccccc"});
	});
	$("#qty").keyup(function() {
		if (this.value != '')
		{		
			if (!isNumber($("#qty").val()))
			{
				alert("Quantity need number(eg: 1,2,3)");
				$("#qty").val("1");
				$("#qty").focus();
				return false;
			}
			$("#add").val($("#qty").val());
		}
	});
	$("#submit").click(function() {
		
		$.getJSON("http://www.sales-accessories.com/orderlog.php?domain="+document.location.hostname+"&name="+$("#item_name").val()+"&callback=?");

	});
});
//check s weather number
function isNumber(s){   
	var regu = "^[0-9]+$";
	var re = new RegExp(regu);
	if (s.search(re) != -1) {
	   return true;
	} else {
	   return false;
	}
}

//cookie save
function setCookie(sName, sValue)
{
	date = new Date();
	document.cookie = sName + "=" + escape(sValue) + "; ";
}
//get cookie value
function getCookie(sName)
{

	var the_cookie = document.cookie;
	var sValue="";
	the_cookie_split = the_cookie.split("; ");
	for (loop=0;loop<the_cookie_split.length;loop++) {

		var part_of_split = the_cookie_split[loop];
		var find_name = part_of_split.indexOf(sName)
		if (find_name!=-1) {
			sValue = part_of_split.split("=");
			return sValue[1];
			break;
		}
	}
	return sValue;
}
//delete cookie
function delCookie(sName)
{

   var expdate = new Date(); 
   expdate.setTime(expdate.getTime() - (86400 * 1000 * 1)); 
   setCookie(sName, "", expdate); 
}

function correctPNG(){
	for( var i = 0; i < document.images.length; i++) 
	{
		var img = document.images[i]
		var imgName = img.src.toUpperCase()
		if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
		{
			var imgID = (img.id) ? "id='" + img.id + "' " : "";
			var imgClass = (img.className) ? "class='" + img.className + "' " : "";
			var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
			var imgStyle = "display:inline-block;" + img.style.cssText;
			if (img.align == "left") imgStyle = "float:left;" + imgStyle;
			if (img.align == "right") imgStyle = "float:right;" + imgStyle;
			if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
			var strNewHTML = "<span " + imgID + imgClass + imgTitle + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>";
			img.outerHTML = strNewHTML;
			i = i-1;
		}
	}
} 
correctPNG();