function FlashTag(src, uid, param, wmode, width, height)
{
    this.src       = src;
    this.uid       = uid;
    this.param     = param;
    this.width     = width;
    this.height    = height;
    this.version   = '7,0,14,0';
    this.id        = null;
    this.bgcolor   = 'ffffff';
    this.wmode     = wmode;
    this.flashVars = null;
}

FlashTag.prototype.setVersion = function(v)
{
    this.version = v;
}

FlashTag.prototype.setId = function(id)
{
    this.id = id;
}


FlashTag.prototype.setFlashvars = function(fv)
{
    this.flashVars = fv;
}

FlashTag.prototype.toString = function()
{
    var ie = (navigator.appName.indexOf ("Microsoft") != -1) ? 1 : 0;
    var flashTag = new String();
    if (ie)
    {
        flashTag += '<object id="' + this.uid + '" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ';
        if (this.id != null)
        {
            flashTag += 'id="'+this.id+'" ';
        }
        flashTag += 'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ';
        flashTag += 'width="'+this.width+'" ';
        flashTag += 'height="'+this.height+'">';
        flashTag += '<param name="movie" value="'+this.src+'"/>';
        flashTag += '<param name="quality" value="high"/>';
		flashTag += '<param name="wmode" value="'+this.wmode+'"/>';
        flashTag += '<param name="bgcolor" value="#'+this.bgcolor+'"/>';
        //flashTag += '<param name="allowScriptAccess" value="sameDomain"/>';
        if (this.flashVars != null)
        {
            flashTag += '<param name="flashvars" value="'+this.flashVars+'&'+this.param+'"/>';
        }
        flashTag += '</object>';
    }
    else
    {
        flashTag += '<embed id="' + this.uid + '" src="'+this.src+'" ';
        flashTag += 'quality="high" '; 
        flashTag += 'bgcolor="#'+this.bgcolor+'" ';
        flashTag += 'width="'+this.width+'" ';
        flashTag += 'height="'+this.height+'" ';
		flashTag += 'wmode="'+this.wmode+'" ';
	//	flashTag += 'allowScriptAccess="sameDomain" ';
        flashTag += 'type="application/x-shockwave-flash" ';
        if (this.flashVars != null)
        {
            flashTag += 'flashvars="'+this.flashVars+'&'+this.param+'" ';
        }
        if (this.id != null)
        {
            flashTag += 'name="'+this.id+'" ';
        }
        flashTag += 'pluginspage="http://www.macromedia.com/go/getflashplayer">';
        flashTag += '</embed>';
    }
	op_n=1;

    return flashTag;
    alert(flashTag);
}

FlashTag.prototype.fetch = function()
{
    return this.toString();
}

function o(id)
{
	return document.getElementById(id);
}

function validateEmail(email){
	var emailRegEx = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if(email.match(emailRegEx)){
		return true;
	}else{
		return false;
	}
}

function sendKontakt() {
	var email = o('email').value;
	var pytanie = o('pytanie').value;
	var sErrMsg = "";
	var bErr = false;
	
	
	if(validateEmail(o('email').value)==false)
	{
		sErrMsg += "\nProszę podać prawidłowy adres e-mail<br>";
		o('errMsg').style.display = "block";		
		bErr = true;
		o('email').focus();
	}
	
	if(pytanie=='')
	{
		sErrMsg += "Proszę wpisać pytanie";
		o('errMsg').style.display = "block";		
		bErr = true;
		o('pytanie').focus();
	}
	
	if (bErr) {
		o('errMsg').innerHTML = sErrMsg;
		return;
	}

	o('errMsg').style.display = "none";	
	o('wyslane').style.display = "block";
	setTimeout(function(){o('wyslane').style.display="none";},10000);
	xajax_sendKontaktForm(email, pytanie);
	o('email').value = "";
	o('pytanie').value = "";
}

var timeout, previousType;

function showSubmenu(type, show, selected) {
	if (show) {
		try {clearTimeout(timeout);} catch (e) {};
		try {o('submenu_' + previousType).style.display = "none";} catch(e) {};
		try {killSubmenu('cennik'); killSubmenu('zabiegi');} catch(e) {};
		
		o('submenu_' + type).style.display = "block";
		o('menuItem' + type).className = "selected";
		o('menuItem' + selected).className = "selected";
	} else {
		timeout = setTimeout(function(){
			o('submenu_' + type).style.display="none";
			if (type != selected){
				o('menuItem' + type).className = "";
				o('menuItem' + selected).className = "selected";
			}
			
		},1000);
		
	}
	previousType = type;
}

function killSubmenu(type, selected) {
	if (type != selected) {
		try {o('menuItem' + type).className = "";} catch (e) {};
		try {o('menuItem' + selected).className = "selected";} catch (e) {};
	}
	try {o('submenu_' + type).style.display = "none";} catch (e) {};
}

function showDiv(id) {
	o(id).style.display = "block";
}

function init()
{
	try {  Shadowbox.init(); } catch(e) { }
	try {  o('snieg').innerHTML = snieg.fetch(); } catch(e) { }
}

(window.attachEvent)?attachEvent('onload', init) : addEventListener('load', init, false);
