(function($){
   $.fn.vCenter = function(options) {
     var pos = {
       sTop : function() {
         return window.pageYOffset || $.boxModel &&
document.documentElement.scrollTop ||   document.body.scrollTop;
       },
       wHeight : function() {
         if ( $.browser.opera || ($.browser.safari && parseInt
($.browser.version) > 520) ) {
return window.innerHeight;
                } else if ( $.browser.safari ) {
                        return window.innerHeight;
                }       else {
           return $.boxModel && document.documentElement.clientHeight
|| document.body.clientHeight;
         }
       }
     };
     return this.each(function(index) {
       if (index == 0) {
         var $this = $(this);
         var elHeight = $this.height();
         $this.css({
           position: 'absolute',
           marginTop: '0',
           top: pos.sTop() + (pos.wHeight() / 2) - (elHeight / 2)
         });
       }
     });
   };

})(jQuery);

(function($){
   $.fn.alwaysTop = function(options) {
     var pos = {
       sTop : function() {
         return window.pageYOffset || $.boxModel &&
document.documentElement.scrollTop ||   document.body.scrollTop;
       },
       wHeight : function() {
         if ( $.browser.opera || ($.browser.safari && parseInt
($.browser.version) > 520) ) {
return window.innerHeight;
                } else if ( $.browser.safari ) {
                        return window.innerHeight;
                }       else {
           return $.boxModel && document.documentElement.clientHeight
|| document.body.clientHeight;
         }
       }
     };
     return this.each(function(index) {
       if (index == 0) {
         var $this = $(this);
         var elHeight = $this.height();
         $this.css({
           position: 'absolute',
           marginTop: '0',
           top: pos.sTop() - elHeight
         });
       }
     });
   };

})(jQuery);

function show_box(e) {
	jQuery('#' + e.target.id + '_popup').addClass('active');
}

function hide_box(e) {
	jQuery('#' + e.target.id + '_popup').removeClass('active');
}

// Page popup windows
jQuery('.shop_with li a, #one_page_right_column li a, #compare a').click(show_popup)

function show_popup(e) {
	jQuery('#' + e.target.id + '_popup').show().vCenter();
}


function validate_pass(formData, jqForm, options) { 
   
   form = '#forgot_pass_form';
	
   jQuery(form + ' .required').each(function () {
   		if (jQuery(this).hasClass('e-mail')) {
			var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
			var address = jQuery(this).val();
			if (reg.test(address) == false) {
				jQuery(this).parent().addClass('error')
				//jQuery(this).next('span.advice').fadeIn(400)
				send = 0;
			}
			else {
				jQuery(this).parent().removeClass('error')
				jQuery(this).next('span.advice').fadeOut(400)
				send = 1;
			}
		}
		else {
			if ((jQuery(this).val() == '') || (jQuery(this).val() == '*************') || (jQuery(this).val() == 'http://')){
				jQuery(this).parent().addClass('error')
				jQuery(this).next('span.advice').fadeIn(400);
				send = 0;
			}
			else {
				jQuery(this).parent().removeClass('error')
				jQuery(this).next('span.advice').fadeOut(400)
				send = 1;
			}
		}
   }) 
    
    if ( send == 0 ) return false;
    else pass_thankyou();
}

function pass_thankyou() {
	jQuery('#forgot_pass').hide(); 
	jQuery('#forgot_pass_form').children().removeClass('error')
	jQuery('#pass_thankyou').show().vCenter()
}

