calformname = "FilterForm";

function ShowCalendar(field)
       {
		if(top.newWin!=null && !top.newWin.closed)top.newWin.close();
               calDateFormat    = "MM/DD/yyyy";
               setSingleDateField(field);
               top.newWin = window.open('/assets/scripts/calendar/calendar.html','cal','dependent=yes,width=230,height=230,screenX=200,screenY=300,titlebar=yes');
               return false;
       }

function popupContentForm(url, page, token, language, mode) {
	url = url + '&fuseactionid=' + page + '&token=' + token + '&languageid=' + language + '&formdisplaymode=' + mode;
	newwindow = window.open(url,'name','height=570,width=650');
	if (window.focus) {newwindow.focus()}
	return false;
}

function checkForm(form)
	{
		
		var el, elName, value, type, em_val;
		var errorText = 
		{
				0 : " is empty",
				1 : " is not valid"
		}

		
		for (var i = 0; i < form.elements.length; i++) 
		{
			el = form.elements[i];
			elName = el.nodeName.toLowerCase();
			value = el.value;
			
			if ((elName == "input") || (elName == "textarea"))
			{ 
				type = el.type.toLowerCase();
				switch (type) 
				{
					case "text" :
					case "textarea" :
						switch (el.name)
							{
								
								case "email" :
											if (value == "") {alert("E-mail " + errorText[0]); return false};
											if (!(/^(([a-zA-Z0-9_\.-])+\@([a-zA-Z0-9-])+(\.([a-zA-Z])+)+)$/.test(value)))
												{ alert("E-mail " + errorText[1]); return false };
											break;
								default  :
											//if (value == "") {alert("Some fields are empty"); return false};
											break;
								
							}
						
					default :
							break;
				}
			}
		}
		
		return true;
		
	}

function popup_window (image_path) {
	var ph = window.open("", "popup_img", "resizable=0,width=100,height=100,location=0,toolbar=0,resize=0,status=0,scrollbars=0");
	ph.document.write('<'+'!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"'+'>');
	ph.document.write('<'+'html'+'>');
	ph.document.write('<'+'head'+'><'+'title'+'><'+'/title'+'>');
	ph.document.write('<'+'style type="text/css"'+'>body { text-align: center; margin: 0px; padding: 0px; }<'+'/style'+'>');
	ph.document.write('<'+'script language="javascript" type="text/javascript"'+'>');
	ph.document.write('window.onload = function ()');
	ph.document.write('{ var a_img = document.getElementById("auto_img");');
	ph.document.write('var NS = (navigator.appName == "Netscape") ? true : false;');
	ph.document.write(
	'if (a_img && NS) '
	+'{ window.resizeTo(a_img.width + window.outerWidth - window.innerWidth + 40, '
	+'a_img.height + window.outerHeight - window.innerHeight); }'
	);
	ph.document.write(
	'else { '
	+ 'var x_ = a_img.width - document.body.clientWidth;'
	+ 'var y_ = a_img.height - document.body.clientHeight;'
	+ 'window.resizeBy(x_, y_);}'
	+' window.moveTo( (screen.width - a_img.width) / 2 , (screen.height - a_img.height) / 2);'
	+ '}'
	);
	ph.document.write('<'+'/script'+'><'+'/head'+'>');
	ph.document.write(
	'<'+'body'+'><'+'img id="auto_img" '
	+'src= "' + image_path + '" '
	+'border="0" align="center" /'+'><'+'/body'+'><'+'/html'+'>'
	);
	ph.document.close();
}
//**/

function show_promt () {
		$.prompt('Item was added to the cart',{ prefix: 'jqi' , opacity: 0});
	}

function onCardChange(form)
	{
		if (form.card_type.value=="PersonalCheck")
		{
			form.card_number.disabled = true;
			form.card_exp_month.disabled = true;
			form.card_exp_year.disabled = true;
			form.card_cvv2.disabled = true;
		}
			else if (form.card_type.value=="MoneyOrder")
		{
			form.card_number.disabled = true;
			form.card_exp_month.disabled = true;
			form.card_exp_year.disabled = true;
			form.card_cvv2.disabled = true;
		}
		else
		{
			form.card_number.disabled = false;
			form.card_exp_month.disabled = false;
			form.card_exp_year.disabled = false;
			form.card_cvv2.disabled = false;
		}
	}
