﻿// ready function to handle product detail page
$(document).ready(function() {
	$(".bar2_button_act a").hover(function() { 
		var currentImg = $(this).children("img").attr('src'); 
		$(this).children("img").attr('src', $(this).children("img").attr('hover')); 
		$(this).children("img").attr('hover', currentImg); 
	}, function() { 
		var currentImg = $(this).children("img").attr('src'); 
		$(this).children("img").attr('src', $(this).children("img").attr('hover')); 
		$(this).children("img").attr('hover', currentImg); 
	}); 

/*	
	$("a[rel='login_popup']").colorbox();
	$("a[rel='login_popup1']").colorbox();
	$("a[rel='login_popup2']").colorbox();
	$("a[rel='privacy_popup']").colorbox();
*/	
	$("a[rel='login_popup']").colorbox({width:460, innerHeight:290, inline:true, href:"#inline_login"});
	$("a[rel='login_popup1']").colorbox({width:460, innerHeight:290, inline:true, href:"#inline_login"});
	$("a[rel='login_popup2']").colorbox({width:460, innerHeight:290, inline:true, href:"#inline_login"});
	$("a[rel='privacy_popup']").colorbox({width:800, innerHeight:600});
	$("a[rel='search_popup']").colorbox({width:600});
	$("a[rel='signup_popup']").colorbox({width:600, innerHeight:100});

	$('ul.sf-menu').superfish({
		delay:  500,
		autoArrows:  false,                           // disable generation of arrow mark-up 
		speed:  'normal',
		dropShadows: false 
	});
	
	$("#login_form").submit(function() {
		var mErrorFlag = false;
		
		// get form values
		if($('[name=luserid]').val() == '') {
			mErrorFlag = true;
			$('[name=luserid]').css('background-color', "red");
		}else {
			$('[name=luserid]').css('background-color', "white");
		}

		if($('[name=lpassword]').val() == '') {
			mErrorFlag = true;
			$('[name=lpassword]').css('background-color', "red");
		}else {
			$('[name=lpassword]').css('background-color', "white");
		}

		if(mErrorFlag == true) {
			$('#msg_content').css('color', "red");
		}else {
/*			
			$('#msg_content').css('color', "gray");
*/
			requestXmlPOST3('login_op.php', 'pdisplay=display_processing', '#msg_content', this);
		}
		return false;
	});
	
	$("#login_form").keypress(function(e) {
		if (e.which == 13) {
			return false;
		}
	});
	
});

