




<!-- validate username & password-->
function validateUNPW(inputValue, id){
var includeText = "01234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM!@."
var includeTextSplitted = includeText.split("");
var inputTextSplitted = inputValue.split("");
var error = new Array();

	for (i=0;i<inputTextSplitted.length;i++){
		error[i] = 'y';
	}
	for (x=0;x<inputTextSplitted.length;x++){
		for (y=0;y<includeTextSplitted.length;y++){
			if (inputTextSplitted[x] == includeTextSplitted[y]){
				error[x] = 'n';
			}			
		}
	}
	for (i=0;i<inputTextSplitted.length;i++){
		if (error[i] == 'y'){
			alert("You have entered a character that's not allowed!");	
			field = "";
			document.getElementById(id).value=field;
			break;
		}
	}
}
<!-- validate username & password-->


<!-- validateText-->
function validateText(inputValue, id){
var includeText = " .'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM"
var includeTextSplitted = includeText.split("");
var inputTextSplitted = inputValue.split("");
var error = new Array();

	for (i=0;i<inputTextSplitted.length;i++){
		error[i] = 'y';
	}
	for (x=0;x<inputTextSplitted.length;x++){
		for (y=0;y<includeTextSplitted.length;y++){
			if (inputTextSplitted[x] == includeTextSplitted[y]){
				error[x] = 'n';
			}			
		}
	}
	for (i=0;i<inputTextSplitted.length;i++){
		if (error[i] == 'y'){
			alert("Please enter a correct value!");	
			field = "";
			document.getElementById(id).value=field;
			break;
		}
	}
}
<!--***end*** validateText-->


<!-- validateNumber-->
function validateNumber(inputValue, id){
var includeText = "0123456789"
var includeTextSplitted = includeText.split("");
var inputTextSplitted = inputValue.split("");
var error = new Array();

	for (i=0;i<inputTextSplitted.length;i++){
		error[i] = 'y';
	}
	for (x=0;x<inputTextSplitted.length;x++){
		for (y=0;y<includeTextSplitted.length;y++){
			if (inputTextSplitted[x] == includeTextSplitted[y]){
				error[x] = 'n';
			}			
		}
	}
	for (i=0;i<inputTextSplitted.length;i++){
		if (error[i] == 'y'){
			alert("Please enter an integer");	
			field = "";
			document.getElementById(id).value=field;			
			break;
		}
	}
}
<!--***end*** validateNumber-->



<!-- validateEmail-->
function validateEmail(inputValue, id){
var includeText = "@.";
var includeTextSplitted = includeText.split("");
var inputTextSplitted = inputValue.split("");
var pass_count = 0;

	for (x=0;x<inputTextSplitted.length;x++){
		for (y=0;y<includeTextSplitted.length;y++){
			if (inputTextSplitted[x] == includeTextSplitted[y]){
				pass_count ++;
			}			
		}
	}
		
		//error message if @ or . is missing
		if (pass_count < 2){
			alert("Please enter a valid e-mail address");	
			field = "";
			document.getElementById(id).value=field;
		}
	
}
<!--***end*** validateEmail-->





<!-- checkillegalcharacters-->
function checkillegalcharacters(inputValue, id){
var illegalText = "><' ";
var illegalTextSplitted = illegalText.split("");
var inputTextSplitted = inputValue.split("");
var illegal_count = 0;

	for (x=0;x<inputTextSplitted.length;x++){
		for (y=0;y<illegalTextSplitted.length;y++){
			if (inputTextSplitted[x] == illegalTextSplitted[y]){
				illegal_count ++;
			}			
		}
	}
		
		//error message if @ or . is missing
		if (illegal_count > 0){
			alert("Please enter again");	
			field = "";
			document.getElementById(id).value=field;
		}
	
}
<!--***end*** checkillegalcharacters-->


function checkmailingaddress1(inputValue, id){
	if (document.new_registration_form.mailing_same_as_physical.checked == true){
		document.new_registration_form.email_mailing_address1.value = document.getElementById(id).value;
	}
}

function checkmailingaddress2(inputValue, id){
	if (document.new_registration_form.mailing_same_as_physical.checked == true){
		document.new_registration_form.email_mailing_address2.value = document.getElementById(id).value;
	}
}

function checkcity(inputValue, id){
	if (document.new_registration_form.mailing_same_as_physical.checked == true){
		document.new_registration_form.email_mailing_city.value = document.getElementById(id).value;
	}
}

function checkstate(inputValue, id){
	if (document.new_registration_form.mailing_same_as_physical.checked == true){
		document.new_registration_form.email_mailing_state.value = document.getElementById(id).value;
	}
}

function checkzip(inputValue, id){
	if (document.new_registration_form.mailing_same_as_physical.checked == true){
		document.new_registration_form.email_mailing_zip.value = document.getElementById(id).value;
	}
}




function validateForm(){
	with(document.registration_form){
		if(email_first_name.value == ""){
			alert("This field is required.");
			email_first_name.focus();
			return false;	
		} else if(email_last_name.value == ""){
			alert("This field is required.");
			email_last_name.focus();
			return false;
		} else if(email_address.value == ""){
			alert("This field is required.");
			email_address.focus();
			return false;
		} else if(email_phone.value == ""){
			alert("This field is required.");
			email_phone.focus();
			return false;		
		} else if(email_password.value == ""){
			alert("This field is required.");
			email_password.focus();
			return false;		
		} else if(email_physical_address1.value == ""){
			alert("This field is required.");
			email_physical_address1.focus();
			return false;
		} else if(email_city.value == ""){
			alert("This field is required.");
			email_city.focus();
			return false;
		} else if(email_state.value == ""){
			alert("This field is required.");
			email_state.focus();
			return false;
		} else if(email_zip.value == ""){
			alert("This field is required.");
			email_zip.focus();
			return false;									
		}else {
			return true;
		}
	}
}




function validateVendorsContactForm(){
	with(document.vendors_contact_form){
		if(_sponsorsnag_vendors_business_name.value == ""){
			alert("This is a required field.");
			_sponsorsnag_vendors_business_name.focus();
			return false;
		} else if(_sponsorsnag_vendors_first_name.value == ""){
			alert("This is a required field.");
			_sponsorsnag_vendors_first_name.focus();
			return false;
		} else if(_sponsorsnag_vendors_last_name.value == ""){
			alert("This is a required field.");
			_sponsorsnag_vendors_last_name.focus();
			return false;
		} else if(_sponsorsnag_vendors_email.value == ""){
			alert("This is a required field.");
			_sponsorsnag_vendors_email.focus();
			return false;
		} else if(_sponsorsnag_vendors_street_address.value == ""){
			alert("This is a required field.");
			_sponsorsnag_vendors_street_address.focus();
			return false;
		} else if(_sponsorsnag_vendors_city.value == ""){
			alert("This is a required field.");
			_sponsorsnag_vendors_city.focus();
			return false;
		} else if(_sponsorsnag_vendors_state.value == ""){
			alert("This is a required field.");
			_sponsorsnag_vendors_state.focus();
			return false;
		} else if(_sponsorsnag_vendors_zip.value == ""){
			alert("This is a required field.");
			_sponsorsnag_vendors_zip.focus();
			return false;
		} else if(_sponsorsnag_vendors_phone.value == ""){
			alert("This is a required field.");
			_sponsorsnag_vendors_phone.focus();
			return false;
		} else if(_sponsorsnag_vendors_website_url.value == ""){
			alert("This is a required field.");
			_sponsorsnag_vendors_website_url.focus();
			return false;
		} else if(_sponsorsnag_vendors_note.value == ""){
			alert("This is a required field.");
			_sponsorsnag_vendors_note.focus();
			return false;
		}else {
			return true;
		}
	}
}



function validateContactForm(){
	with(document.contact_form){
		if(your_first_name.value == ""){
			alert("Please enter your name.");
			your_first_name.focus();
			return false;
		} else if(your_last_name.value == ""){
			alert("Please enter your name.");
			your_last_name.focus();
			return false;
		} else if(your_contact_email.value == ""){
			alert("Please enter your e-mail.");
			your_contact_email.focus();
			return false;
		} else if(your_phone.value == ""){
			alert("Please enter your phone number.");
			your_phone.focus();
			return false;
		} else if(your_note.value == ""){
			alert("Please enter this field.");
			your_note.focus();
			return false;
		}else {
			return true;
		}
	}
}


function dailyDealValidate(){
	with(document.daily_deal){
		if(match.value == ""){
			alert("Please enter your e-mail address.");
			match.focus();
			return false;
		} else if(coupon_singlemarket_id_select.value == ""){
			alert("Please select a city.");
			coupon_singlemarket_id_select.focus();
			return false;
		}else {
			return true;
		}
	}
}


function validateForm2(){
	with(document.login){
		if(loginemail.value == ""){
			alert("Please enter your e-mail address.");
			loginemail.focus();
			return false;
		} else if(loginpassword.value == ""){
			alert("Please enter your password.");
			loginpassword.focus();
			return false;
		}else {
			return true;
		}
	}
}



function validateForm3(){
	with(document.new_registration_form){
		if(email_first_name.value == ""){
			alert("Please enter your first name.");
			email_first_name.focus();
			return false;	
		} else if(email_last_name.value == ""){
			alert("Please enter your last name.");
			email_last_name.focus();
			return false;			
		} else if(email_address.value == ""){
			alert("Please enter your e-mail address.");
			email_address.focus();
			return false;
		} else if(email_password.value == ""){
			alert("Please enter your password.");
			email_password.focus();
			return false;
		} else if(email_nickname.value == ""){
			alert("Please choose a nickname.");
			email_nickname.focus();
			return false;		
		} else if(email_security_answer.value == ""){
			alert("Please enter your answer.");
			email_security_answer.focus();
			return false;		
		} else if(email_birthdate_month.value == ""){
			alert("This field is required.");
			email_birthdate_month.focus();
			return false;
		} else if(email_birthdate_date.value == ""){
			alert("This field is required.");
			email_birthdate_date.focus();
			return false;
		} else if(email_birthdate_year.value == ""){
			alert("This field is required.");
			email_birthdate_year.focus();
			return false;
		} else if(email_phone.value == ""){
			alert("This field is required.");
			email_phone.focus();
			return false;
		} else if(email_physical_address1.value == ""){
			alert("This field is required.");
			email_physical_address1.focus();
			return false;
		} else if(email_city.value == ""){
			alert("This field is required.");
			email_city.focus();
			return false;
		} else if(email_state.value == ""){
			alert("This field is required.");
			email_state.focus();
			return false;
		} else if(email_zip.value == ""){
			alert("This field is required.");
			email_zip.focus();
			return false;		
		} else if(email_country.value == ""){
			alert("This field is required.");
			email_country.focus();
			return false;			
		}else {
			return true;
		}
	}
}


function validateLoginForm(){
	with(document.login_form){
		if(un.value == ""){
			alert("Please enter your e-mail address. We require an e-mail address in order to login.");
			un.focus();
			return false;
		}else {
			return true;
		}
	}
}



function validateLoginFormOnly(){
	with(document.login_form_only){
		if(un.value == ""){
			alert("Please enter your e-mail address. We require an e-mail address in order to login.");
			un.focus();
			return false;
		}else {
			return true;
		}
	}
}


function validateInviteFriendForm(){
	with(document.invite_a_friend_form){
		if(email_friend_friends_email.value == ""){
			alert("Please enter your friend's e-mail address.");
			email_friend_friends_email.focus();
			return false;
		}else {
			return true;
		}
	}
}




function validateFormPayPal(){
	with(document.shoppingcart){
		if(shoppingcart_client_first_name_new.value == ""){
			alert("This is a required field!.");
			shoppingcart_client_first_name_new.focus();
			return false;
		} else if(shoppingcart_client_last_name_new.value == ""){
			alert("This is a required field!.");
			shoppingcart_client_last_name_new.focus();
			return false;
		} else if(shoppingcart_client_address1_new.value == ""){
			alert("This is a required field!.");
			shoppingcart_client_address1_new.focus();
			return false;
		} else if(shoppingcart_client_city_new.value == ""){
			alert("This is a required field!.");
			shoppingcart_client_city_new.focus();
			return false;
		} else if(shoppingcart_client_phone1_new.value == ""){
			alert("This is a required field!.");
			shoppingcart_client_phone1_new.focus();
			return false;
		} else if(shoppingcart_client_email1_new.value == ""){
			alert("This is a required field!.");
			shoppingcart_client_email1_new.focus();
			return false;
		} else if(shoppingcart_amount_new.value <= 0){
			alert("Transaction amount must be greater than $0!.");
			shoppingcart_amount_new.focus();
			return false;
		} else if(agree.checked == false){
			alert("You must first agree to the terms and conditions before the checkout.");
			agree.focus();
			return false;	
		}else {
			return true;
		}
	}
}






function seasonalClubForm(){
	with(document.eclub_form_parent){
		if(eclub_parent_first_name.value == ""){
			alert("This is a required field!.");
			eclub_parent_first_name.focus();
			return false;
		} else if(eclub_parent_last_name.value == ""){
			alert("This is a required field!.");
			eclub_parent_last_name.focus();
			return false;
		} else if(dob_year.value == ""){
			alert("This is a required field!.");
			dob_year.focus();
			return false;
		} else if(eclub_parent_email.value == ""){
			alert("This is a required field!.");
			eclub_parent_email.focus();
			return false;
		} else if(eclub_parent_wishlist_password.value == ""){
			alert("This is a required field!.");
			eclub_parent_wishlist_password.focus();
			return false;
		} else if(eclub_parent_address.value == ""){
			alert("This is a required field!.");
			eclub_parent_address.focus();
			return false;
		} else if(eclub_parent_city.value == ""){
			alert("This is a required field!.");
			eclub_parent_city.focus();
			return false;
		} else if(eclub_parent_state.value == ""){
			alert("This is a required field!.");
			eclub_parent_state.focus();
			return false;
		} else if(eclub_parent_zip.value == ""){
			alert("This is a required field!.");
			eclub_parent_zip.focus();
			return false;
		} else if(eclub_parent_phone.value == ""){
			alert("This is a required field!.");
			eclub_parent_phone.focus();
			return false;
		} else if(agree_to_terms.checked == false){
			alert("You must first agree to the terms and conditions.");
			agree_to_terms.focus();
			return false;	
		}else {
			return true;
		}
	}
}





function viewPic(img)
{ 	
    picfile = new Image(); 
    picfile.src =(img); 
    fileCheck(img); 
} 
function fileCheck(img)
{ 	
    if( (picfile.width!=0) && (picfile.height!=0) )
    { 
        makeWindow(img); 
    }
    else 
    {
        funzione="fileCheck('"+img+"')"; 
        intervallo=setTimeout(funzione,50); 
    }
}
function makeWindow(img)
{ 	
    ht = picfile.height + 18;
    wd = picfile.width + 18; 

    var args= "height=" + ht + ",innerHeight=" + ht;
    args += ",width=" + wd + ",innerWidth=" + wd;
    if (window.screen) 
    { 
        var avht = screen.availHeight; 
        var avwd = screen.availWidth;
        var xcen = (avwd - wd) / 2; 
        var ycen = (avht - ht) / 2;
        args += ",left=" + xcen + ",screenX=" + xcen;
        args += ",top=" + ycen + ",screenY=" + ycen + ",resizable=yes"; 	
    }
    return window.open(img, '', args); 
} 







/***********************************************
* Image w/ description tooltip- By Dynamic Web Coding (www.dyn-web.com)
* Copyright 2002-2007 by Sharon Paine
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
* Modified by Steven Kang March 2007
***********************************************/

/* IMPORTANT: Put script after tooltip div or 
	 put tooltip div just before </BODY>. */

var dom = (document.getElementById) ? true : false;
var ns5 = (!document.all && dom || window.opera) ? true: false;
var ie5 = ((navigator.userAgent.indexOf("MSIE")>-1) && dom) ? true : false;
var ie4 = (document.all && !dom) ? true : false;
var nodyn = (!ns5 && !ie4 && !ie5 && !dom) ? true : false;

var origWidth, origHeight;

// avoid error of passing event object in older browsers
if (nodyn) { event = "nope" }

///////////////////////  CUSTOMIZE HERE   ////////////////////
// settings for tooltip 
// Do you want tip to move when mouse moves over link?
var tipFollowMouse= true;	
// Be sure to set tipWidth wide enough for widest image
var tipWidth= 518;
var offX= 20;	// how far from mouse to show tip
var offY= 12; 
var tipFontFamily= "Verdana, arial, helvetica, sans-serif";
var tipFontSize= "8pt";
// set default text color and background color for tooltip here
// individual tooltips can have their own (set in messages arrays)
// but don't have to
var tipFontColor= "#000000";
var tipBgColor= "#ffffff"; 
var tipBorderColor= "#990000";
var tipBorderWidth= 1;
var tipBorderStyle= "ridge";
var tipPadding= 0;

// tooltip content goes here (image, description, optional bgColor, optional textcolor)
var messages = new Array();
// multi-dimensional arrays containing: 
// image and text for tooltip
// optional: bgColor and color to be sent to tooltip
messages[0] = new Array('images/drum.jpg','Drum',"#ff0000");
messages[1] = new Array('images/piano.jpg','Piano',"#ffffff");
messages[2] = new Array('test.gif','Test description','black','white');

////////////////////  END OF CUSTOMIZATION AREA  ///////////////////

// preload images that are to appear in tooltip
// from arrays above
if (document.images) {
	var theImgs = new Array();
	for (var i=0; i<messages.length; i++) {
  	theImgs[i] = new Image();
		theImgs[i].src = messages[i][0];
  }
}

// to layout image and text, 2-row table, image centered in top cell
// these go in var tip in doTooltip function
// startStr goes before image, midStr goes between image and text
var startStr = '<table width="' + tipWidth + '"><tr><td align="center" width="100%"><img src="';
var midStr = '" border="0"></td></tr><tr><td valign="top">';
var endStr = '</td></tr></table>';

////////////////////////////////////////////////////////////
//  initTip	- initialization for tooltip.
//		Global variables for tooltip. 
//		Set styles
//		Set up mousemove capture if tipFollowMouse set true.
////////////////////////////////////////////////////////////
var tooltip, tipcss;
function initTip() {
	if (nodyn) return;
	tooltip = (ie4)? document.all['tipDiv']: (ie5||ns5)? document.getElementById('tipDiv'): null;
	
	if (tooltip.style){
		tipcss = tooltip.style;
	}
	
	if (ie4||ie5||ns5) {	// ns4 would lose all this on rewrites
		tipcss.width = tipWidth+"px";
		tipcss.fontFamily = tipFontFamily;
		tipcss.fontSize = tipFontSize;
		tipcss.color = tipFontColor;
		tipcss.backgroundColor = tipBgColor;
		tipcss.borderColor = tipBorderColor;
		tipcss.borderWidth = tipBorderWidth+"px";
		tipcss.padding = tipPadding+"px";
		tipcss.borderStyle = tipBorderStyle;
	}
	if (tooltip&&tipFollowMouse) {
		document.onmousemove = trackMouse;
	}
}

window.onload = initTip;

/////////////////////////////////////////////////
//  doTooltip function
//			Assembles content for tooltip and writes 
//			it to tipDiv
/////////////////////////////////////////////////
var t1,t2;	// for setTimeouts
var tipOn = false;	// check if over tooltip link
function doTooltip(evt,num,imgsrc,imageWidth,imageMessage,bgColor,fontTextColor,BorderColor) {

var tipWidth = imageWidth + 6;
var startStr = '<table width="' + tipWidth + '"><tr><td align="center" width="100%"><img src="';
var midStr = '" border="0"></td></tr><tr><td valign="top">';
var endStr = '</td></tr></table>';

	if (tooltip.style){
		tipcss = tooltip.style;
	}

	if (ie4||ie5||ns5) {	// ns4 would lose all this on rewrites
		tipcss.borderColor = BorderColor;
		tipcss.width = tipWidth+"px";
	}

	if (!tooltip) return;
	if (t1) clearTimeout(t1);	if (t2) clearTimeout(t2);
	tipOn = true;
	// set colors if included in messages array
	if (bgColor)	var curBgColor = bgColor;
	else curBgColor = tipBgColor;
	if (fontTextColor)	var curFontColor = fontTextColor;
	else curFontColor = tipFontColor;
	if (ie4||ie5||ns5) {
		var tip = startStr + imgsrc + midStr + '<span style="font-family:' + tipFontFamily + '; font-size:' + tipFontSize + '; color:' + curFontColor + ';">' + imageMessage + '</span>' + endStr;
		tipcss.backgroundColor = curBgColor;
	 	tooltip.innerHTML = tip;
	}
	if (!tipFollowMouse) positionTip(evt);
	else t1=setTimeout("tipcss.visibility='visible'",100);
}

var mouseX, mouseY;
function trackMouse(evt) {
	standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
	mouseX = (ns5)? evt.pageX: window.event.clientX + standardbody.scrollLeft;
	mouseY = (ns5)? evt.pageY: window.event.clientY + standardbody.scrollTop;
	if (tipOn) positionTip(evt);
}

/////////////////////////////////////////////////////////////
//  positionTip function
//		If tipFollowMouse set false, so trackMouse function
//		not being used, get position of mouseover event.
//		Calculations use mouseover event position, 
//		offset amounts and tooltip width to position
//		tooltip within window.
/////////////////////////////////////////////////////////////
function positionTip(evt) {
	if (!tipFollowMouse) {
		mouseX = (ns5)? evt.pageX: window.event.clientX + standardbody.scrollLeft;
		mouseY = (ns5)? evt.pageY: window.event.clientY + standardbody.scrollTop;
	}
	// tooltip width and height
	var tpWd = (ie4||ie5)? tooltip.clientWidth: tooltip.offsetWidth;
	var tpHt = (ie4||ie5)? tooltip.clientHeight: tooltip.offsetHeight;
	// document area in view (subtract scrollbar width for ns)
	var winWd = (ns5)? window.innerWidth-20+window.pageXOffset: standardbody.clientWidth+standardbody.scrollLeft;
	var winHt = (ns5)? window.innerHeight-20+window.pageYOffset: standardbody.clientHeight+standardbody.scrollTop;
	// check mouse position against tip and window dimensions
	// and position the tooltip 
	if ((mouseX+offX+tpWd)>winWd) 
		tipcss.left = mouseX-(tpWd+offX)+"px";
	else tipcss.left = mouseX+offX+"px";
	if ((mouseY+offY+tpHt)>winHt) 
		tipcss.top = winHt-(tpHt+offY)+"px";
	else tipcss.top = mouseY+offY+"px";
	if (!tipFollowMouse) t1=setTimeout("tipcss.visibility='visible'",100);
}

function hideTip() {
	if (!tooltip) return;
	t2=setTimeout("tipcss.visibility='hidden'",100);
	tipOn = false;
}

document.write('<div id="tipDiv" style="position:absolute; visibility:hidden; z-index:100;"></div>')

