function d(id){
	return document.getElementById(id);
}
function RND(){
	Stamp = new Date();
	return Stamp.getSeconds()+' '+Math.round(Math.random()*4);
}
function setCookie(name, value, expires, path, domain) {
	var never = new Date();
	never.setTime(never.getTime() + 24 * 60 * 60 * 1000 * 365);
	if(expires.toLowerCase() == "never") expires = never;

	var cookie = name+"="+escape(value);
	cookie = cookie + ((expires==null)?"":("; expires="+expires.toGMTString()));
	cookie = cookie + ((path==null)?"":("; path="+path));
	cookie = cookie + ((domain==null)?"":("; domain="+domain));
	document.cookie=cookie;
}
function emailCheck(emailStr) {
	var emailPat = /^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$/;
	var matchArray = emailStr.match(emailPat);
	if (matchArray == null) return false;
	var IPArray = matchArray[2].match(/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/);
	if (IPArray != null)
		for (var i=1;i<=4;i++)
			if (IPArray[i]>255)
				return false;
	return true;
}

function getPageX(event) {
	if (!event) event=window.event;
	return event.pageX || (event.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft));
}
function getPageY(event) {
	if (!event) event=window.event;
	return event.pageY || (event.clientY + (document.documentElement.scrollTop || document.body.scrollTop));
}

function isPositionInElement(x, y, e, eX ,eY) {//page coordinates
	if (eX==null || eY==null) {
		var pos=getElementPosition(e);
		eX=pos.x;
		eY=pos.y;
	}
	return (x>eX && x<eX+e.offsetWidth && y>eY && y<eY+e.offsetHeight);
}
function get_radio_value(obj){
	for (var i=0; i < obj.length; i++){
		if (obj[i].checked){
			return obj[i].value;
		}
	}
	return false;
}

function showBannerFlash(flash, productId){
	var width = 90;
	var height = 170;
	document.write('<div class="divx" style="width:'+width+'px;height:'+height+'px;"><div style="width:'+width+'px;height:'+height+'px;" class="divxinner"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" width="'+width+'" height="'+height+'" id="banner'+productId+'">');
	
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="movie" value="'+flash+'" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="bgcolor" value="#eeeeee" />');
	
	document.write('<embed src="'+flash+'" quality="high" bgcolor="#eeeeee" width="'+width+'" height="'+height+'" name="banner'+productId+'" align="middle" allowScriptAccess="sameDomain" play="true" loop="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object></div></div>');
}

function showMyFlash(flash, image){
	document.write('<embed src="/mediaplayer.swf"');
	document.write('width="300" ');
	document.write('height="220" ');
	document.write('allowscriptaccess="always" ');
	document.write('allowfullscreen="true" ');
	document.write('flashvars="width=300&height=220&file='+flash+'&image='+image+'&displayheight=220&searchbar=false" ');
	document.write('/>');
}