function Browser(){
	var ua = navigator.userAgent.toLowerCase(); 
	this.Gecko = (ua.indexOf('gecko') != -1 && ua.indexOf('safari') == -1);
	this.Safari = (ua.indexOf('safari') != - 1);
	this.IE = (ua.indexOf('msie') != -1 && !this.Opera && (ua.indexOf('webtv') == -1) ); 
	this.Mozilla = (this.Gecko && ua.indexOf('gecko/') + 14 == ua.length);
	this.Firefox = ( (ua.indexOf('firebird/') != -1) || (ua.indexOf('firefox/') != -1) );
	this.NS = ( (this.Gecko) ? (ua.indexOf('netscape') != -1) : ( (ua.indexOf('mozilla') != -1) && !this.Opera && !this.Safari && (ua.indexOf('spoofer') == -1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('webtv') == -1) && (ua.indexOf('hotjava') == -1) ) );
	this.IECompatible = ( (ua.indexOf('msie') != -1) && !this.IE);
	this.NSCompatible = ( (ua.indexOf('mozilla') != -1) && !this.NS && !this.Mozilla);
	this.geckoVersion = ( (this.Gecko) ? ua.substring( (ua.lastIndexOf('gecko/') + 6), (ua.lastIndexOf('gecko/') + 14) ) : -1 );
	this.equivalentMozilla = ( (this.Gecko) ? parseFloat( ua.substring( ua.indexOf('rv:') + 3 ) ) : -1 );
	this.versionMinor = parseFloat(navigator.appVersion); 
	if (this.Gecko && !this.Mozilla) this.versionMinor = parseFloat( ua.substring( ua.indexOf('/', ua.indexOf('gecko/') + 6) + 1 ) );
	else if (this.Mozilla) this.versionMinor = parseFloat( ua.substring( ua.indexOf('rv:') + 3 ) );
	else if (this.IE && this.versionMinor >= 4) this.versionMinor = parseFloat( ua.substring( ua.indexOf('msie ') + 5 ) );
	else if (this.Safari) this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('safari/') + 7 ) );
	this.versionMajor = parseInt(this.versionMinor); 
	this.DOM1 = (document.getElementById);
	this.DOM2Event = (document.addEventListener && document.removeEventListener);
	this.mode = document.compatMode ? document.compatMode : 'BackCompat';
	this.Win = (ua.indexOf('win') != -1);
	this.Win32 = (this.Win && ( ua.indexOf('95') != -1 || ua.indexOf('98') != -1 || ua.indexOf('nt') != -1 || ua.indexOf('win32') != -1 || ua.indexOf('32bit') != -1 || ua.indexOf('xp') != -1) );
	this.Mac = (ua.indexOf('mac') != -1);

	this.NS4 = (this.NS && this.versionMajor == 4);
	this.NS6x = (this.NS && this.versionMajor == 6);
	this.NS6up = (this.NS && this.versionMajor >= 6);
	this.NS7x = (this.NS && this.versionMajor == 7);
	this.NS7up = (this.NS && this.versionMajor >= 7);

	this.IE4 = (this.IE && this.versionMajor == 4);
	this.IE4up = (this.IE && this.versionMajor >= 4);
	this.IE5 = (this.IE && this.versionMajor == 5);
	this.IE55 = (this.IE && this.versionMinor == 5.5);
	this.IE5up = (this.IE && this.versionMajor >= 5);
	this.IE6x = (this.IE && this.versionMajor == 6);
	this.IE6up = (this.IE && this.versionMajor >= 6);
}
var is = new Browser();


var mTimer;
var llid;

function movr(lid) {
	clearTimeout(mTimer);
	if(llid!=lid) {
		hideActive();
	}
	document.getElementById("mLayer"+lid).style.visibility="visible";
	if(lid==2 && document.getElementById("lst_product_list")) {
		document.getElementById("lst_product_list").style.visibility="hidden";
	}
	llid=lid;
	SelectVisible("hidden",document.getElementsByTagName('select'));
}

function mout(lid) {
	mTimer=setTimeout("do_mout("+lid+")",100);
	SelectVisible("visible",document.getElementsByTagName('select'));
}

function do_mout(lid) {
	document.getElementById("mLayer"+lid).style.visibility="hidden";
	if(lid==2 && document.getElementById("lst_product_list")) {
		document.getElementById("lst_product_list").style.visibility="visible";
	}
}

function hideActive() {
	if(mTimer) {
		do_mout(llid);
	}
}

function goPage(obj) {
	var sval=obj.options[obj.selectedIndex].value;
	if(sval!=0)
		location.href=sval;
}

function selectShort() {
	var durl=(document.location.href).split('/')[(document.location.href).split('/').length-1];
	var obj=document.getElementById('shortmenu');
	
	for (i=0;i<=obj.options.length-1;i++) {
		if (durl==obj.options[i].value) {
			document.getElementById('shortmenu').options[i].selected=true;
		}
	}
}

function popItUp(url,width,height,s) {
	if(s) {
		width+=17;
	}
	window.open(url,"_regal_bigimg","top=0, width="+width+", height="+height+", scrollbars="+s);
}

function checkTextAreaLen(element, MaxLen) {
		elementTA = document.forms(0).elements[element];
		elementCL = document.getElementById(element + "CHARLEFT");//forms(0).elements[element + "CHARLEFT"];
	   var StrLen = elementTA.value.length, CharsLeft = 0;
		if (StrLen == 1 && elementTA.value.substring(0, 1) == " ") {
			elementTA.value = "";
			StrLen = 0;
		}
		if (StrLen > MaxLen ) {
			elementTA.value = elementTA.value.substring(0, MaxLen);
		}
		else {
			CharsLeft = StrLen;	
		}
		elementCL.innerText = MaxLen - CharsLeft;
	}

	
function preLoad() {
	var tmpImg=new Array();
	for(i=0;i<arguments.length;i++) {
		tmpImg[i]=new Image();
		tmpImg[i].src=arguments[i];
	}
}

//preLoad("/i/menucont_bg.gif","/i/arama_bg.jpg");


function isDefined(property) {
	return (typeof property != 'undefined');
}

var flashVersion = 0;
function getFlashVersion() {
	var latestFlashVersion = 8;
	var agent = navigator.userAgent.toLowerCase(); 
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		var flashPlugin = navigator.plugins['Shockwave Flash'];
		if (typeof flashPlugin == 'object'){ 
			for (var i = latestFlashVersion; i >= 3; i--){
	            if (flashPlugin.description.indexOf(i + '.') != -1){
	               flashVersion = i;
	               break;
	            }
			}
		}
	}

	else if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && agent.indexOf("win")!=-1 && agent.indexOf("16bit")==-1) {
		var doc = '<scr' + 'ipt language="VBScript"\> \n';
		doc += 'On Error Resume Next \n';
		doc += 'Dim obFlash \n';
		doc += 'For i = ' + latestFlashVersion + ' To 3 Step -1 \n';
		doc += '	Set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash." & i) \n';
		doc += '	If IsObject(obFlash) Then \n';
		doc += '		flashVersion = i \n';
		doc += '		Exit For \n';
		doc += '	End If \n';
		doc += 'Next \n';
		doc += '</scr' + 'ipt\> \n';
		document.write(doc);
	}
	else{
		flashVersion = flashVersion_DONTKNOW;
	}

return flashVersion;

}
flashVersion_DONTKNOW = -1;

function FlashObject(){
	this.maxVersion;
	this.SwfFile;

	this.minVersion;
	this.altSwfFile;

	this.altImage;
	this.altImageAddAtribute;
	this.altImageHTML;

	this.width;
	this.height;
	this.menu;
	this.background;
}

FlashObject.prototype.rnd=function(){
	this.ranNum= Math.random()*64;
    return this.ranNum;
}
function SelectVisible(v,elem) {
	for (var i=0;i<elem.length;i++) elem[i].style.visibility=v;
}

FlashObject.prototype.embed=function(){
	if(getFlashVersion()>=this.maxVersion){
		document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" WIDTH='+this.width+' HEIGHT='+this.height+'><PARAM NAME=movie VALUE="'+this.SwfFile+'?'+this.rnd()+'"><PARAM NAME=menu VALUE='+this.menu+'><PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE='+this.background+'><param name="wmode" value="transparent">');
		document.write('<EMBED src="'+this.SwfFile+'?'+this.rnd()+'" menu=false quality=high bgcolor='+this.background+'  WIDTH='+this.width+' HEIGHT='+this.height+' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" wmode="transparent"></EMBED>');
		document.write('</OBJECT>');
	}
	else if((getFlashVersion()> this.minVersion) && (getFlashVersion()< this.maxVersion) && this.altSwfFile){
		document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" WIDTH='+this.width+' HEIGHT='+this.height+'><PARAM NAME=movie VALUE="'+this.altSwfFile+'?'+this.rnd()+'"><PARAM NAME=menu VALUE='+this.menu+'><PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE='+this.background+'><param name="wmode" value="transparent">');
		document.write('<EMBED src="'+this.altSwfFile+'?'+this.rnd()+'" menu=false quality=high bgcolor='+this.background+'  WIDTH='+this.width+' HEIGHT='+this.height+' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" wmode="transparent"></EMBED>');
		document.write('</OBJECT>');
	}else{
		if(this.altImageAddAtribute){
			document.write('<img src="'+this.altImage+'" width="'+this.width+'" height="'+this.height+'" border="0" '+this.altImageAddAtribute+' />');
			document.write(this.altImageHTML);
		}else{
			document.write('<img src="'+this.altImage+'" width="'+this.width+'" height="'+this.height+'" border="0" />');
			document.write(this.altImageHTML);
		}
	}
}
