/*
* Copyright (C) 2009 Joel Sutherland.
* Liscenced under the MIT liscense
*/
(function($){$.fn.filterable=function(settings){settings=$.extend({useHash:true,animationSpeed:1000,show:{width:'show',opacity:'show'},hide:{width:'hide',opacity:'hide'},useTags:true,tagSelector:'#portfolio-filter a',selectedTagClass:'current',allTag:'all'},settings);return $(this).each(function(){$(this).bind("filter",function(e,tagToShow){if(settings.useTags){$(settings.tagSelector).removeClass(settings.selectedTagClass);$(settings.tagSelector+'[href='+tagToShow+']').addClass(settings.selectedTagClass)}$(this).trigger("filterportfolio",[tagToShow.substr(1)])});$(this).bind("filterportfolio",function(e,classToShow){if(classToShow==settings.allTag){$(this).trigger("show")}else{$(this).trigger("show",['.'+classToShow]);$(this).trigger("hide",[':not(.'+classToShow+')'])}if(settings.useHash){location.hash='#'+classToShow}});$(this).bind("show",function(e,selectorToShow){$(this).children(selectorToShow).animate(settings.show,settings.animationSpeed)});$(this).bind("hide",function(e,selectorToHide){$(this).children(selectorToHide).animate(settings.hide,settings.animationSpeed)});if(settings.useHash){if(location.hash!='')$(this).trigger("filter",[location.hash]);else $(this).trigger("filter",['#'+settings.allTag])}if(settings.useTags){$(settings.tagSelector).click(function(){$('#portfolio-list').trigger("filter",[$(this).attr('href')]);$(settings.tagSelector).removeClass('current');$(this).addClass('current')})}})}})(jQuery);$(document).ready(function(){$('#portfolio-list').filterable()});


function G(id) {  
	return document.getElementById(id) ;  
}; 
function checkemail(){
	if(G("gender").value==""){
	    alert("please choose gender");
	    G("gender").focus();
	    return false;
    }
	
	if(G("fname").value==""){
		alert("please fill the required fields (First name)");
	    G("fname").focus();
		return false;
	}
	if(G("lname").value==""){
	    alert("please fill the required fields (Last name)");
	    G("lname").focus();
	    return false;
    }
	if(G("country").value==""){
	    alert("please choose country");
	    G("country").focus();
	    return false;
    }

	if(G("email").value==""){
	    alert("please fill the required fields (email)");
	    G("email").focus();
	    return false;
	}
	var emailStr=G("email").value;
	var emailPat=/^(.+)@(.+)$/;
	var matchArray=emailStr.match(emailPat);
	if (matchArray==null) {
		alert("email fromat is wrong");
		G("email").focus();
		return false;
	}
	if(G("wyiwu").value==""){
		alert("please fill the required fields (When will you come to Yiwu)");
	    G("wyiwu").focus();
	    return false;
	}	
	if(G("hday").value=="0"){
	    alert("please choose How many days will you stay in Yiwu?");
	    G("hday").focus();
	    return false;
    }
	if(G("hmp").value=="0"){
	    alert("please choose How many days will you stay in Yiwu?");
	    G("hmp").focus();
	    return false;
    }
	if(G("pickup").value=="0"){
	    alert("please choose Do you need us pick up you?");
	    G("pickup").focus();
	    return false;
    }	
	if(G("hpn").value=="0"){
	    alert("please choose How many products do you need?");
	    G("hpn").focus();
	    return false;
    }
	if(G("hspeed").value=="0"){
	    alert("please choose How much will you spend in this Yiwu trip?");
	    G("hspeed").focus();
	    return false;
    }
	 
	if(G("wkp").value==""){
	    alert("please fill the required fields (What kind of products do you want to import? )");
	    G("wkp").focus();
	    return false;
    }
	 
     return true;
	
}
