﻿var preloadFlag = false;

// from http://www.mredkj.com/javascript/numberFormat.html#addcommas
function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}

$(document).ready(function(){
	pre_b_login2 = newImage('images/b_login2.png');
	pre_b_login1 = newImage('images/b_login1.png');
	pre_b_itemsearch1 = newImage('images/b_itemsearch1.png');
	pre_b_itemsearch2 = newImage('images/b_itemsearch2.png');
	pre_b_dealersearch1 = newImage('images/b_dealersearch1.png');
	pre_b_dealersearch2 = newImage('images/b_dealersearch2.png');
	preloadFlag = true;
	
	$('div.shop_prod_contain').hover(
	    function() {$(this).addClass("shop_prod_hover")},
	    function()  {$(this).removeClass("shop_prod_hover")}
	);
	
	$('a.shop_prod:first').addClass("shop_prod_first");
	
	$('input.toggle').css('color','gray').focus(
	    function()
	    {
	        if ($(this).val() == this.defaultValue)
	            $(this).val('');
	        $(this).css('color','black');
	    }
	).blur(
	    function()
	    {
	        if($(this).val() == '')
	        {
	            $(this).val(this.defaultValue);
	            $(this).css('color','Gray');
	        }
	    }
	).css('color','Gray');
});
