function flashMovie(location, width, height, wmode) {
	document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase=' http://fpdownload.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+width+"' height='"+height+"'");
	document.write("<param name='allowScriptAccess' value='always' />");
	document.write("<param name='allowFullScreen' value='true' />");
	document.write("<param name='movie' value='"+location+"' />");
	document.write("<param name='wmode' value='"+wmode+"' />");
	document.write("<param name='menu' value='false' />");
	document.write("<param name='quality' value='best' />");
	document.write("<embed src='"+location+"' width='"+width+"' height='"+height+"' wmode='"+wmode+"' menu='false' quality='best' allowScriptAccess='always' allowFullScreen='true' type='application/x-shockwave-flash' pluginspage='http://www.adobe.com/go/getflashplayer' />");
	document.write("</object>");
}

function MM_jumpMenu(targ,selObj,restore) {
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}

function infocus(obj) {
	obj.style.border = '2px solid royalblue';
}

function outfocus(obj) {
	obj.style.border = '2px solid lightgrey';
}

function Popup(obj, W, H) {
	var CW = document.documentElement.clientWidth;
	var CH = document.documentElement.clientHeight;
	var object = document.getElementById(obj);
	if (W > CW || H > CH) {
		var X = document.documentElement.scrollLeft;
		var Y = document.documentElement.scrollTop;
	} else {
		var X = (document.documentElement.clientWidth / 2) - (W / 2);
		var Y = (document.documentElement.clientHeight / 2) - (H / 2) + document.documentElement.scrollTop;
	}
	object.style.left = X;
	object.style.top = Y;
	object.style.display = 'block'
}

function PopupClose(obj) {
	document.getElementById(obj).style.display = "none";
}

function Zipcode(target, finish) {
	var X = (screen.availWidth / 2) - 200;
	var Y = (screen.availHeight / 2) - 160;
	window.open("/common/zipcode.asp?target="+target+"&finish="+finish+"", "zipcode", "left="+X+", top="+Y+", width=500, height=300, scrollbars=yes");
}

function View(obj, count) {
	for (i=1; i <= count; i++) {
		var object = 'obj'+i;
		if (object == obj) {
			var object = document.getElementById(object);
			object.style.display = 'block';
		} else {
			var object = document.getElementById(object);
			object.style.display = 'none';
		}
	}
}

function ViewNew(name, num, count) {
	for (i=1; i <= count; i++) {
		var source = name+i;
		var target = name+num;
		var object = document.getElementById(source);
		if (source == target) {	object.style.display = 'block';	} else { object.style.display = 'none'; }
	}
}

function viewHide(obj) {
	var object = document.getElementById(obj)
	if ( object.style.display == 'none' ) object.style.display = 'block';
	else object.style.display = 'none';
}

function inputNumber(obj) {
	var str = obj.value;
	var matchStr = new RegExp("[^0-9]", "gi");
	obj.value = str.replace(matchStr, "");
}

function inputSingle(obj) {
	var str = obj.value;
	var matchStr = new RegExp("[^0-9a-z-_]", "gi");
	obj.value = str.replace(matchStr, "");
}

function lenCheck(maxlen, field) {
	var temp;
	var msglen;
	msglen = maxlen * 2;
	var value = field.value;
	 
	l =  field.value.length; 
	tmpstr = "";

	if (l == 0) {
		value = maxlen * 2;
	} else {
		for(k=0;k<l;k++) {
			temp = value.charAt(k);
			if (escape(temp).length > 4) msglen -= 2;	else msglen--;
			if(msglen < 0) {
				alert("Oops! [length]");
				field.value= tmpstr;
				break;
			} else {
				tmpstr += temp;
			}
		}
	}
}
