

// JQuery

$(document).ready(function() {

	$(".hdr > ul > li[class='change_menu']").hover(function() {

		$(this).addClass("active").find("ul").show();

	},function() {

		$(this).removeClass("active").find("ul").hide();

	});



});

// JQuery

$(document).ready(function() {

	$(".whp_div > span[class='dis_drop']").hover(function() {

		$(this).addClass("dis_active").find("ul").show();

	},function() {

		$(this).removeClass("is_active").find("ul").hide();

	});



});

// JQuery

$(document).ready(function() {

	$(".nav_div > ul > li[class='nav_sub']").hover(function() {

		$(this).addClass("nav_active").find(".drop_div").show();

	},function() {

		$(this).removeClass("nav_active").find(".drop_div").hide();

	});



});

// JQuery

$(document).ready(function(){

    $(".small_con").mouseover(function(){

	    $(this).addClass("add_bg");

	});

	$(".small_con").mouseout(function(){

	     $(this).removeClass("add_bg");

	});

});

// JQuery

$(document).ready(function(){

	    var $div_li =$("div.tab_menu ul li");

	    $div_li.click(function(){

			$(this).addClass("selected")          

				   .siblings().removeClass("selected"); 

            var index =  $div_li.index(this);  

			$("div.tab_box > div")   	

					.eq(index).show()  

					.siblings().hide(); 

		}).click(function(){

			$(this).addClass("hover");

		},function(){

			$(this).removeClass("hover");

		})

})



// JQuery

$(document).ready(function(){



	$("#drop_left_id h3").click(function(){

		$(this).toggleClass("bottomIco_id")

			   .next().slideToggle(300)

			   .siblings("ul").slideUp("slow");

		$(this).siblings("h3").removeClass("bottomIco_id");

	});

});



$(document).ready(function(){

	$("#drop_left h3").click(function(){

		$(this).toggleClass("bottomIco")

			   .next().slideToggle(300)

			   .siblings("ul").slideUp("slow");

		$(this).siblings("h3").removeClass("bottomIco");

	});

});



// JQuery

$(function(){

    var page = 1;

    var i = 4; 

	var len = $(".dis_ind_tab ul li").length;

	var page_count = Math.ceil(len / i) ; 

	var none_unit_width = $(".dis_out_width").width();

	var $parent = $(".dis_ind_tab"); 



    $(".right_btn").click(function(){ 

		if( !$parent.is(":animated") ){

			if( page == page_count ){  

				$parent.animate({ left : 0}, 800);

				page = 1;

			}else{

				$parent.animate({ left : '-='+none_unit_width}, 800);

				page++;

			}

		}

   });



    $(".left_btn").click(function(){

	    if( !$parent.is(":animated") ){

			if( page == 1 ){ 

				$parent.animate({ left : '-='+none_unit_width*(page_count-1)}, 800);

				page = page_count;

			}else{

				$parent.animate({ left : '+='+none_unit_width }, 800);

				page--;

			}

		}

    });

});



function changecustomSize(obj)

{

    if(obj.checked)

	{

		 document.getElementById('customsizestyle').style.display = 'block';

		 //lengtharr = $('.VariationSelect').length;

		 //$('.VariationSelect').each(function(i) {if((i+1)==lengtharr) { $(this).val(0);$(this).attr('disabled',true);} });

	}

	else

	{

		 document.getElementById('customsizestyle').style.display = 'none';

		 //$('.VariationSelect').each(function(i) {if((i+1)==lengtharr) { $(this).val(0);$(this).attr('disabled',false);} });

	}

}

var scrolltotop={setting:{startline:100,scrollto:0,scrollduration:0,fadeduration:[500,100]},controlHTML:'<img src="http://www.dressesshop.com/images/top.jpg" />',controlattrs:{offsetx:5,offsety:5},anchorkeyword:'#top',state:{isvisible:false,shouldvisible:false},scrollup:function(){if(!this.cssfixedsupport)
this.$control.css({opacity:0})
var dest=isNaN(this.setting.scrollto)?this.setting.scrollto:parseInt(this.setting.scrollto)
if(typeof dest=="string"&&jQuery('#'+dest).length==1)
dest=jQuery('#'+dest).offset().top
else
dest=0
this.$body.animate({scrollTop:dest},this.setting.scrollduration);},keepfixed:function(){var $window=jQuery(window)
var controlx=$window.scrollLeft()+$window.width()-this.$control.width()-this.controlattrs.offsetx
var controly=$window.scrollTop()+$window.height()-this.$control.height()-this.controlattrs.offsety
this.$control.css({left:controlx+'px',top:controly+'px'})},togglecontrol:function(){var scrolltop=jQuery(window).scrollTop()
if(!this.cssfixedsupport)
this.keepfixed()
this.state.shouldvisible=(scrolltop>=this.setting.startline)?true:false
if(this.state.shouldvisible&&!this.state.isvisible){this.$control.stop().animate({opacity:1},this.setting.fadeduration[0])
this.state.isvisible=true}
else if(this.state.shouldvisible==false&&this.state.isvisible){this.$control.stop().animate({opacity:0},this.setting.fadeduration[1])
this.state.isvisible=false}},init:function(){jQuery(document).ready(function($){var mainobj=scrolltotop
var iebrws=document.all
mainobj.cssfixedsupport=!iebrws||iebrws&&document.compatMode=="CSS1Compat"&&window.XMLHttpRequest
mainobj.$body=(window.opera)?(document.compatMode=="CSS1Compat"?$('html'):$('body')):$('html,body')
mainobj.$control=$('<div id="topcontrol">'+mainobj.controlHTML+'</div>').css({position:mainobj.cssfixedsupport?'fixed':'absolute',bottom:mainobj.controlattrs.offsety,right:mainobj.controlattrs.offsetx,opacity:0,cursor:'pointer'}).attr({title:'Scroll Back to Top'}).click(function(){mainobj.scrollup();return false}).appendTo('body')
if(document.all&&!window.XMLHttpRequest&&mainobj.$control.text()!='')
mainobj.$control.css({width:mainobj.$control.width()})
mainobj.togglecontrol()
$('a[href="'+mainobj.anchorkeyword+'"]').click(function(){mainobj.scrollup()
return false})
$(window).bind('scroll resize',function(e){mainobj.togglecontrol()})})}}
scrolltotop.init()


// JQuery

function setTab(name,cursel,n){

for(i=1;i<=n;i++){

var menu=document.getElementById(name+i);

var con=document.getElementById("con_"+name+"_"+i);

menu.className=i==cursel?"hover":"";

con.style.display=i==cursel?"block":"none";

}

}





$(function(){

	

    $("ul.rating li a").click(function(){

	     var title = $(this).attr("title");

		 var cl = $(this).parent().attr("class");

		 switch(cl) {

         case 'one':

			 num = 1;

		     break;

		 case 'two':

			 num = 2;

		     break;

		 case 'three':

			 num = 3;

		     break;

		 case 'four':

			 num = 4;

		     break;

		 case 'five':

			 num = 5;

		     break;

		 default:

			 num = '';

		 }

		 $('#revrating').val(num);

		 $(this).parent().parent().removeClass().addClass("rating "+cl+"star");

		 $(this).blur();

		 return false;

	})

})



$(function(){

    $(".write_btn").bind("click",function(){

		$("#writebox").show();

	})

})



var config = {};

var lang = {};





/* Common Javascript functions for use throughout Shopping Cart */



// Fetch the value of a cookie

function get_cookie(name) {

	name = name += "=";

	var cookie_start = document.cookie.indexOf(name);

	if(cookie_start > -1) {

		cookie_start = cookie_start+name.length;

		cookie_end = document.cookie.indexOf(';', cookie_start);

		if(cookie_end == -1) {

			cookie_end = document.cookie.length;

		}

		return unescape(document.cookie.substring(cookie_start, cookie_end));

	}

}



// Set a cookie

function set_cookie(name, value, expires)

{

	if(!expires) {

		expires = "; expires=Wed, 1 Jan 2020 00:00:00 GMT;"

	} else {

		expire = new Date();

		expire.setTime(expire.getTime()+(expires*1000));

		expires = "; expires="+expire.toGMTString();

	}

	document.cookie = name+"="+escape(value)+expires;

}



/* Javascript functions for the products page */

var num_products_to_compare = 0;

var product_option_value = "";

var CurrentProdTab = "";

function showProductImage(filename, product_id, currentImage) {

	var l = (screen.availWidth/2)-350;

	var t = (screen.availHeight/2)-300;

	var variationAdd = '';

	if(ShowVariationThumb) {

		variationAdd = '&variation_id='+$('body').attr('currentVariation');

		CurrentProdThumbImage = null;

	}

	UrlAddOn = '';



	if(currentImage) {

		UrlAddOn = "&current_image="+currentImage;

	} else if(CurrentProdThumbImage) {

		UrlAddOn = "&current_image="+CurrentProdThumbImage;

	}

	var imgPopup = window.open(filename + "?product_id="+product_id+variationAdd+UrlAddOn, "imagePop", "toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=700,height=600,top="+t+",left="+l);

	imgPopup.focus();

}



function CheckProductConfigurableFields(form)

{

	var requiredFields = $('.FieldRequired');

	var valid = true;

	requiredFields.each(function() {

		var namePart = this.name.replace(/^.*\[/, '');

		var fieldId = namePart.replace(/\].*$/, '');



		if(this.type=='checkbox' ) {

			if(!this.checked) {

				valid = false;

				alert(lang.EnterRequiredField);

				this.focus();

				this.select();

				return false;

			}

		} else if(this.value == '') {

			if(this.type != 'file' || (this.type == 'file' && document.getElementById('CurrentProductFile_'+fieldId).value == '')) {

				valid = false;

				alert(lang.EnterRequiredField);

				this.focus();

				this.select();

				return false;

			}

		}

	});



	var fileFields = $(form).find('input[type=file]');

	fileFields.each(function() {

		if(this.value != '') {

			var namePart = this.name.replace(/^.*\[/, '');

			var fieldId = namePart.replace(/\].*$/, '');

			var fileTypes = document.getElementById('ProductFileType_'+fieldId).value;



			fileTypes = ','+fileTypes.replace(' ', '').toLowerCase()+','

			var ext = this.value.replace(/^.*\./, '').toLowerCase();



			if(fileTypes.indexOf(','+ext+',') == -1) {

				alert(lang.InvalidFileTypeJS);

				this.focus();

				this.select();

				valid = false;

			}



		}

	});



	return valid;

}



function check_add_to_cart(form, required) {

	var valid = true;

	var qtyInputs = $(form).find('input.qtyInput');

	qtyInputs.each(function() {

		if(isNaN($(this).val()) || $(this).val() <= 0) {

			alert(lang.InvalidQuantity);

			this.focus();

			this.select();

			valid = false;

			return false;

		}

	});

	if(valid == false) {

		return false;

	}



	if(!CheckProductConfigurableFields(form)) {

		return false;

	}



	if(required && !$(form).find('.CartVariationId').val()) {

		alert(lang.OptionMessage);

		var select = $(form).find('select').get(0);

		if(select) {

			select.focus();

		}

		var radio = $(form).find('input[type=radio]').get(0);

		if(radio) {

			radio.focus();

		}

		return false;

	}



	if (!CheckEventDate()) {

		return false;

	}



	return true;

}



function compareProducts(compare_path) {

	var pids = "";



	if($('form').find('input[name=compare_product_ids][checked]').size() >= 2) {

		var cpids = document.getElementsByName('compare_product_ids');



		for(i = 0; i < cpids.length; i++) {

			if(cpids[i].checked)

				pids = pids + cpids[i].value + "/";

		}



		pids = pids.replace(/\/$/, "");

		document.location.href = compare_path + pids;

		return false;

	}

	else {

		alert(lang.CompareSelectMessage);

		return false;

	}

}



function product_comparison_box_changed(state) {

	// Increment num_products_to_compare - needs to be > 0 to submit the product comparison form





	if(state)

		num_products_to_compare++;

	else

		if (num_products_to_compare != 0)

			num_products_to_compare--;

}



function remove_product_from_comparison(id) {

	if(num_compare_items > 2) {

		for(i = 1; i < 11; i++) {

			document.getElementById("compare_"+i+"_"+id).style.display = "none";

		}



		num_compare_items--;

	}

	else {

		alert(lang.CompareTwoProducts);

	}

}



function show_product_review_form() {

	document.getElementById("rating_box").style.display = "";

	if(typeof(HideProductTabs) != 'undefined' && HideProductTabs == 0) {

		CurrentProdTab = 'ProductReviews_Tab';

	} else {

		document.location.href = "#write_review";

	}

}



function jump_to_product_reviews() {

	if(typeof(HideProductTabs) != 'undefined' && HideProductTabs == 0) {

		CurrentProdTab = 'ProductReviews_Tab';

	} else {

		document.location.href = "#reviews";

	}

}



function g(id) {

	return document.getElementById(id);

}



function check_product_review_form() {

	var revrating = g("revrating");

	var revtitle = g("revtitle");

	var revtext = g("revtext");

	var revfromname = g("revfromname");

	var captcha = g("captcha");



	if(revrating.selectedIndex == 0) {

		alert(lang.ReviewNoRating);

		revrating.focus();

		return false;

	}



	if(revtitle.value == "") {

		alert(lang.ReviewNoTitle);

		revtitle.focus();

		return false;

	}



	if(revtext.value == "") {

		alert(lang.ReviewNoText);

		revtext.focus();

		return false;

	}



	if(captcha.value == "" && HideReviewCaptcha != "none") {

		alert(lang.ReviewNoCaptcha);

		captcha.focus();

		return false;

	}



	return true;

}



function check_small_search_form() {

	var search_query = g("search_query");



	if(search_query.value == "") {

		alert(lang.EmptySmallSearch);

		search_query.focus();

		return false;

	}



	return true;

}



function setCurrency(currencyId)

{

	var gotoURL = location.href;



	if (location.search !== '')

	{

		if (gotoURL.search(/[&|\?]setCurrencyId=[0-9]+/) > -1)

			gotoURL = gotoURL.replace(/([&|\?]setCurrencyId=)[0-9]+/, '$1' + currencyId);

		else

			gotoURL = gotoURL + '&setCurrencyId=' + currencyId;

	}

	else

		gotoURL = gotoURL + '?setCurrencyId=' + currencyId;



	location.href = gotoURL;

}





// Dummy sel_panel function for when design mode isn't enabled

function sel_panel(id) {}



function inline_add_to_cart(filename, product_id, quantity, returnTo) {

	if(typeof(quantity) == 'undefined') {

		var quantity = '1';

	}

	var html = '<form action="' + filename + '/cart.php" method="post" id="inlineCartAdd">';

	if(typeof(returnTo) != 'undefined' && returnTo == true) {

		var returnLocation = window.location;

		html += '<input type="hidden" name="returnUrl" value="'+escape(returnLocation)+'" />';

	}

	html += '<input type="hidden" name="action" value="add" />';

	html += '<input type="hidden" name="qty" value="'+quantity+'" />';

	html += '<input type="hidden" name="product_id" value="'+product_id+'" />';

	html += '<\/form>';

   $('body').append(html);

   $('#inlineCartAdd').submit();

}



function ShowPopupHelp(content, url, decodeHtmlEntities) {

	var popupWindow = open('', 'view','height=450,width=550');



	if(decodeHtmlEntities) {

		content = HtmlEntityDecode(content);

	}

	if (window.focus) {

		popupWindow.focus();

	}



	var doc = popupWindow.document;

	doc.write(content);

	doc.close();



	return false;

}



function HtmlEntityDecode(str) {

   try {

      var tarea=document.createElement('textarea');

      tarea.innerHTML = str; return tarea.value;

      tarea.parentNode.removeChild(tarea);

   } catch(e) {

      //for IE add <div id="htmlconverter" style="display:none;"></div> to the page

      document.getElementById("htmlconverter").innerHTML = '<textarea id="innerConverter">' + str + '</textarea>';

      var content = document.getElementById("innerConverter").value;

      document.getElementById("htmlconverter").innerHTML = "";

      return content;

   }

}



function setProductThumbHeight()

{

	var ImageBoxDiv = $('.Content .ProductList .ProductImage');

	var ImageListDiv = $('.Content .ProductList:not(.List) li');

	var CurrentListHeight = ImageListDiv.height();

	var ProductImageMargin = ImageBoxDiv.css('margin-left')*2;

/*

	ImageBoxDiv.height(ThumbImageHeight);

	ImageBoxDiv.width(ThumbImageWidth);

	ImageBoxDiv.css('line-height', ThumbImageHeight+'px');

*/



	var ImageBoxHeight = ThumbImageHeight;



	if (parseInt(ImageBoxDiv.css("padding-top"), 10)) {

		ImageBoxHeight += parseInt(ImageBoxDiv.css("padding-top"), 10) * 2; //Total Padding Width

	}



	if(parseInt(ImageBoxDiv.css("margin-top"), 10)) {

		ImageBoxHeight += parseInt(ImageBoxDiv.css("margin-top"), 10) * 2; //Total Margin Width

	}



	if (parseInt(ImageBoxDiv.css("borderTopWidth"), 10)) {

		ImageBoxHeight += parseInt(ImageBoxDiv.css("borderTopWidth"), 10) * 2; //Total Border Width

	}



	ImageBoxDiv.height(ImageBoxHeight);

	ImageBoxDiv.width(ThumbImageWidth);

	ImageBoxDiv.css('line-height', ImageBoxHeight+'px');





	//calculate the new list container width based on the difference between the thumb image and default thumb size

	var ImageListWidth = ImageListDiv.width() + (ThumbImageWidth-120);

	ImageListDiv.width(ImageListWidth);



//	var ImageListHeight = ImageListDiv.height() + (ImageBoxDiv.height() - 120);

//	ImageListDiv.height(ImageListHeight);







	$('.Content .ProductList.List .ProductDetails').css('margin-left',ThumbImageWidth+2+'px');

	$('.Content .ProductList.List li').height(Math.max(CurrentListHeight, ThumbImageHeight));

}



// Dummy JS object to hold language strings.

var lang = {

};



// IE 6 doesn't support the :hover selector on elements other than links, so

// we use jQuery to work some magic to get our hover styles applied.

if(document.all) {

	var isIE7 = /*@cc_on@if(@_jscript_version>=5.7)!@end@*/false;

	if(isIE7 == false) {

		$(document).ready(function() {

			

			$('.ComparisonTable tr').hover(function() {

				$(this).addClass('Over');

			},

			function() {

				$(this).removeClass('Over');

			});

		});

	}

	

}



function ShowLoadingIndicator() {

	if (typeof(disableLoadingIndicator) != 'undefined' && disableLoadingIndicator) {

		return;

	}

	var windowWidth = $(window).width();

	var scrollTop;

	if(self.pageYOffset) {

		scrollTop = self.pageYOffset;

	}

	else if(document.documentElement && document.documentElement.scrollTop) {

		scrollTop = document.documentElement.scrollTop;

	}

	else if(document.body) {

		scrollTop = document.body.scrollTop;

	}

	$('#AjaxLoading').css('position', 'absolute');

	$('#AjaxLoading').css('top', scrollTop+'px');

	$('#AjaxLoading').css('left', parseInt((windowWidth-150)/2)+"px");

	$('#AjaxLoading').show();

}



function HideLoadingIndicator() {

	$('#AjaxLoading').hide();

}





var loadedImages = {};



// Ensure that all product lists are the same height

function setProductListHeights(imgName) {

	// hack job putting this here but it needs to be reused by search ajax pager

	if (typeof(DesignMode) != 'undefined') {

		return;

	}



	if (imgName != 'undefined') {

		if (typeof loadedImages[imgName] != 'undefined') {

			return;

		}

		

		loadedImages[imgName] = true;

	}



	//setProductThumbHeight();



	/**

	 * Sets the height of the elements passed in to match that of the one that

	 * has the greatest height.

	 *

	 * @param ele The element(s) to adjust the height for.

	 * @return void

	 */

	function setHeight(ele) {

		var ele       = $(ele),

			maxHeight = 0;



		ele

			// reset the height just in case it was set by the stylesheet so

			// we can detect it

			.css('height', 'auto')

			// get the one with the greatest height

			.each(function() {

				if ($(this).height() > maxHeight) {

					maxHeight = $(this).height();

				}

			})

			// and set them all to the greatest height

			.css('height', maxHeight);

	}



	//setHeight('.Content .ProductList:not(.List) li .ProductDetails');



	if (typeof imgName != 'undefined') {

		//setHeight('.Content .ProductList:not(.List) li .ProductPriceRating:has(img[src$='+imgName+'])');

	}



	//setHeight('.Content .ProductList:not(.List) li');

}





/**

* Adds a script tag to the DOM that forces a hit to tracksearchclick. Should be called by a mousedown event as calling it by a click event can sometimes be cancelled by the browser navigating away from the page.

*/

function isc_TrackSearchClick (searchId) {

	if (!searchId) {

		return;

	}



	$('#SearchTracker').remove();



	var trackurl = 'search.php?action=tracksearchclick&searchid=' + encodeURIComponent(searchId) + '&random=' + Math.random();



	var script = document.createElement('script');

	script.type = "text/javascript";

	script.src = trackurl;

	script.id = "SearchTracker";



	window.document.body.appendChild(script);

}



$(document).ready(function() {

	

	if($('.Rating img').length > 0) {

		$('.Rating img').each(function() {

			if($(this).height() == 0) {

				$(this).load(function() {

					var imgName = $(this).attr('src').split('/');

					var imgKey = imgName.length-1;

					//setProductListHeights(imgName[imgKey]);

				});	

			} else {

				//setProductListHeights();

				return false;

			}

		});	

	} else {

		//setProductListHeights();

	}



	$('.InitialFocus').focus();

	$('table.Stylize tr:first-child').addClass('First');

	$('table.Stylize tr:last-child').addClass('Last');

	$('table.Stylize tr td:odd').addClass('Odd');

	$('table.Stylize tr td:even').addClass('Even');

	$('table.Stylize tr:even').addClass('Odd');

	$('table.Stylize tr:even').addClass('Even');



	$('.TabContainer .TabNav li').click(function() {

		$(this).parent('.TabNav').find('li').removeClass('Active');

		$(this).parents('.TabContainer').find('.TabContent').hide();

		$(this).addClass('Active');

		$(this).parents('.TabContainer').find('#TabContent'+this.id).show();

		$(this).find('a').blur();

		return false;

	});



	/*$('html').ajaxStart(function() {

		ShowLoadingIndicator();

	});



	$('html').ajaxComplete(function() {

		HideLoadingIndicator();

	});*/

});



var config = {};



function GetProduct(catid,page,direct)

{

   if(page==0 && direct=='up')

	{

     alert('You have reached the first page');

	 return false;

	}



   if(page==0 && direct=='down')

	{

     alert('You have reached the last page');

	 return false;

	}



	$.post(config.ShopPath+"/remote.php", { w: "GetProductRecommended", prodmaincat: catid, page:page },

    function(data){

     $('.Recommended').html(data);

   });

}



function SendLargeOrderInquiry()

{

 var productname = $('#inquiryproductname').val();

 var productsku = $('#inquiryproductsku').val();

 var inquiryname = $('#inquiryname').val();

 var inquiryemail = $('#inquiryemail').val();

 var inquiryphone = $('#inquiryphone').val();

 var inquiryquantity = $('#inquiryquantity').val();

 var inquirycontent = $('#inquirycontent').val();

 if(inquiryname=='')

 {   $('#sendresult').css('color','red');

	 $('#sendresult').html('Inquiry name is required'); 

	 $('#inquiryname').css('border','1px solid red');

	 return false;

 }

 if(inquiryemail=='')

 {   $('#sendresult').css('color','red');

	 $('#sendresult').html('Inquiry email address is required');

	 $('#inquiryemail').css('border','1px solid red');

	 return false;

 }

 else if(!isEmail(inquiryemail))

	{

     $('#sendresult').css('color','red');

	 $('#sendresult').html('Email address is invalid');

	 $('#inquiryemail').css('border','1px solid red');

	 return false;

	}

 if(inquiryphone=='')

 {   $('#sendresult').css('color','red');

	 $('#sendresult').html('Inquiry phone number is required');

	 $('#inquiryphone').css('border','1px solid red');

	 return false;

 }

 else if(!isphone(inquiryphone))

	{

     $('#sendresult').css('color','red');

	 $('#sendresult').html('Phone number is invalid');

	 $('#inquiryphone').css('border','1px solid red');

	 return false;

	}

 if(inquiryquantity=='')

 {   $('#sendresult').css('color','red');

	 $('#sendresult').html('Inquiry quantity is required');

	 $('#inquiryquantity').css('border','1px solid red');

	 return false;

 }

 else if(!isdigital(inquiryquantity))

	{

     $('#sendresult').css('color','red');

	 $('#sendresult').html('Quantity is invalid');

	 $('#inquiryquantity').css('border','1px solid red');

	 return false;

	}

 if(inquirycontent=='')

 {   $('#sendresult').css('color','red');

	 $('#sendresult').html('Inquiry content is required');

	 $('#inquirycontent').css('border','1px solid red');

	 return false;

 }



 $.ajax({

   type: "POST",

   url: config.ShopPath+"/remote.php",

   data: "w=sendInquiry&prodname="+productname+"&prodsku="+productsku+"&inquiryname="+inquiryname+"&inquiryemail="+inquiryemail+"&inquiryphone="+inquiryphone+"&inquiryquantity="+inquiryquantity+"&inquirycontent="+inquirycontent,

   success: function(data){

	 if(data==1)

	   {

       $('#sendresult').css('color','green');

	   alert('Your Inquiry has been send to our system, thank you!');

	   $("#cboxClose").click();

	   }

	   else

	   {

       $('#sendresult').css('color','red');

	   $('#sendresult').html('Something went wrong while you sending your inquiry, please try again');

	   }

   }

 });



}



function isEmail (theStr) {

var atIndex = theStr.indexOf('@');

var dotIndex = theStr.indexOf('.', atIndex);

var flag = true;

theSub = theStr.substring(0, dotIndex+1)

if ((atIndex < 1)||(atIndex != theStr.lastIndexOf('@'))||(dotIndex < atIndex + 2)||(theStr.length <= theSub.length)) 

{ return(false); }

else { return(true); }

}



function isphone(thestr)

{

var pater = /(([0-9]{2,}[-]?[0-9]{1,}){1,})/;

if(!pater.test(thestr))

	{

	return false;

	}

	return true;

}



function isdigital(thestr)

{

var pater = /([0-9]{1,})/;

if(!pater.test(thestr))

	{

	return false;

	}

	return true;

}



function checkReviewForm()

{

    if($('#author').val()=='')

	{

     $('#reviewtips').html('Please enter nickname!');

	 return false;

	}

	if($('#title').val()=='')

	{

     $('#reviewtips').html('Please enter title!');

	 return false;

	}

	if($('#content').val()=='')

	{

    $('#reviewtips').html('Please enter content!');

	 return false;

	}

	return true;

}


$(function(){
$(".color_outer span.color_title").hover(function(){
    $("#flag_time").val(0);
	$(this).children("ul").show();
	$(this).addClass("hover");	
}, function(){
	$("#flag_time").val(1);									 
	$(this).children("ul").hide();
	$(this).removeClass("hover");	
});

});

$(function(){
	$(".color_outer ul li").click(function(){ 
	    var imgSrc = $(this).attr("class");    
		if($(this)[0].className=='as_pic'){
			$("#variantions_color").val( "Same as the model");
		}else{
			$("#variantions_color").val( $(this).text() );	
		}
		$(this).parents("span").find("a").text($(this).text() );
		$(this).parents("span").find("a").attr("class",imgSrc);
		  
	});
});



$(function(){  
	$(".VariationSelect").attr("disabled",false);
    $(".custom_size").toggle(function(){
			$(this).addClass("custom_size_up");
			$(this).next().show();
	},function(){
			$(this).removeClass("custom_size_up");
			$(this).next().hide();

	});
})

var EndTime= new Date(2011,10,06,0,0);
function GetRTime(){
NowTime = new Date();
var nMS=EndTime.getTime() - NowTime.getTime();
var nD=Math.floor(nMS/(1000 * 60 * 60 * 24));
var nH=Math.floor(nMS/(1000*60*60)) % 24;
var nM=Math.floor(nMS/(1000*60)) % 60;
var nS=Math.floor(nMS/1000) % 60;
var nMS=Math.floor(nMS%100);
if($("#flag_time").val() ==1){
	if(nD>= 0){
		document.getElementById("RemainD").innerHTML=show2w(nD);
		document.getElementById("RemainH").innerHTML=show2w(nH);
		document.getElementById("RemainM").innerHTML=show2w(nM);
		document.getElementById("RemainS").innerHTML=show2w(nS); /*   + " <font style='color:#ffffff;font-weight:normal;'>:</font> " + show2w(nMS);  */
	}
	else {
	document.getElementById("CountMsg").innerHTML=" ";
	}
}
setTimeout("GetRTime()",0);
}
$(document).ready(function(){
GetRTime();
});

function show2w(d){
	if(d<10){
		return "0"+d;
	}else{
		return d;
	}
}

window.onload=function()
{
 for(var ii=0; ii<document.links.length; ii++)
 document.links[ii].onfocus=function(){this.blur()}
}


