function topNavOver()
{
	/*$("top_nav_box").morph("border-bottom:#FFF solid 2px;");*/
	$("top_nav_box").morph("background:#000000;");
	
}
function topNavOut()
{
	/*$("top_nav_box").morph("border-bottom:0;");*/
	$("top_nav_box").morph("background:#424242;");
/*	$("top_nav_box").style.background = "#424242";
*/}
function showHideSize(input,id,id2)
{
	if(input.checked == true)
	{
		$(id).style.visibility = 'visible';
	}
	else
	{
		$(id).style.visibility = 'hidden';
		$(id2).style.visibility = 'hidden';
	}
} 
function showHideAmount(input,id)
{
	if(input.checked == true)
	{
		$(id).style.display = 'block';
		$(id).style.opacity = '0';
		$(id).morph("opacity:1;");
	}
	else if(input.checked == false)
	{
		$(id).style.display = "none";
	}
	else if(input.value != "")
	{
		$(id).style.display = 'block';
	}
	else
	{
		$(id).style.display = 'none';
	}
}
		
		


function getDocHeight() {
    var D = document;
    return Math.max(
        Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
        Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
        Math.max(D.body.clientHeight, D.documentElement.clientHeight)
    );
}

function dopasujStopke()
{
	var htmlheight = document.body.parentNode.clientHeight; 
	var InnerHeight = document.body.clientHeight;
 	
	wysokosc_stopy = htmlheight - InnerHeight;
	$('foot').style.height=wysokosc_stopy+35+'px';
}
function showMessage()
{
	if($("flashMessage"))
	{
		$("message").style.display="block";
		
		setTimeout('$("message").morph("opacity:0;");',5000);
		setTimeout('$("message").style.display="none";',6000);
                
	}
}
function showAdminMessage()
{
	if($("flashMessage"))
	{
		$("message_admin").style.display="block";
		
		setTimeout('$("message_admin").morph("opacity:0;");',5000);
		setTimeout('$("message_admin").style.display="none";',6000);
                
	}
}

function showKontaktMessage()
{
	if($("flashMessage"))
	{
		$("message").style.display="block";

		setTimeout('$("message").morph("opacity:0;");',6000);
		setTimeout('$("message").style.display="none";',7000);
                setTimeout('$("message").style.opacity="0.7";',8000);
	}
}

function projectMenuSwitch()
{
	
	
	if($('info').style.display=='none')
	{
		$('arrow').innerHTML = '<img src="/img/bg_btn_projekty_h.gif" />';
		
		$('project_select_box').morph('height:480px; margin-bottom:-480px; ');
		
		$('box1').style.display='block';
		$('box2').style.display='block';
		$('box3').style.display='block';
		$('box4').style.display='block';
		$('box5').style.display='block';
		$('box1').morph('opacity:1;');
		$('box2').morph('opacity:1;');
		$('box3').morph('opacity:1;');
		$('box4').morph('opacity:1;');
		$('box5').morph('opacity:1;');
		
		$('info').style.display='block';
		
	}
	else
	{
		$('arrow').innerHTML = '<img src="/img/bg_btn_projekty.gif" />';
		
		$('project_select_box').morph('height:0px; margin-bottom:0px; ');
		
		$('box1').morph('opacity:0;');
		$('box2').morph('opacity:0;');
		$('box3').morph('opacity:0;');
		$('box4').morph('opacity:0;');
		$('box5').morph('opacity:0;');
		setTimeout('$("box1").style.display="none";',800);
		setTimeout('$("box2").style.display="none";',800);
		setTimeout('$("box3").style.display="none";',800);
		setTimeout('$("box4").style.display="none";',800);
		setTimeout('$("box5").style.display="none";',800);
		
		$('info').style.display='none';
	}
}
function zmien_jezyk(now,dest)
{
	myUrl = location.href; 
	temp = myUrl.split(now);
	window.location = temp[0] + dest + temp[1];
	return false;
}

function sprawdz_formularz(AForm)
{        
	if(AForm.MailMessName.value == "")
	{
            $('message').update("<div id='flashMessage' class='message'>Prosze wypełnić pole imię.</div>");
            showKontaktMessage();
            return false;
        }
        
        if(AForm.MailMessContent.value == "")
	{
            $('message').update("<div id='flashMessage' class='message'>Proszę podać treść wiadomości</div>");
            showKontaktMessage();
            return false;
        }

	reg = /^[a-zA-Z0-9acelnószzACELNÓSZZ\.]{1,30}@[a-zA-Z0-9acelnószzACELNÓSZZ]+(\.[a-zA-Z0-9acelnószzACELNÓSZZ]+)+$/;
        wynik  = AForm.MailMessEmail.value.match(reg);

        if (wynik  == null) {
            $('message').update("<div id='flashMessage' class='message'>Prosze podac poprawny adres email.</div>");
             showKontaktMessage();
            return false;
        }

        return true;
}
function sprawdz_formularz_sklepowy(AForm)
{    
	for(i=0;i<70;i++)
	{	
		produkt = "Product"+i+"Order";
		if($(produkt))
		{
			if($(produkt).checked)
			{
				
				box_id = i + "_sklep_order";
				amount = i + "_ilosc";
				male_amount = i + "_meska_ilosc";
				male_size = i + "_meska_rozmiar";
				female_amount = i + "_damska_ilosc";
				female_size = i + "_damska_rozmiar";
				
				if($('ShopMessage'))
				{
					$('ShopMessage').style.opacity = '0.8';
					$('ShopMessage').style.display = 'block';
					setTimeout('$("ShopMessage").morph("opacity:0;");',3000);
					setTimeout('$("ShopMessage").style.display = "none";',4000);
					
				}
				
				if($(box_id))
				{
					$(box_id).style.display = 'block';
				}
				if($(amount))
				{
					$(amount).style.display = 'block';
				}
				if($(male_amount))
				{
					$(male_amount).style.display = 'block';
				}
				if($(male_size))
				{
					$(male_size).style.display = 'block';
				}
				if($(female_amount))
				{
					$(female_amount).style.display = 'block';
				}
				if($(female_size))
				{
					$(female_size).style.display = 'block';
				}
			}
			else
			{
				
			}
		}
		else
		{
			
		}
	}
}

function pokaz_komunikat_o_bledach()
{
	if($('ShopMessage'))
	{
		$('ShopMessage').style.opacity = '0.8';
		$('ShopMessage').style.display = 'block';
		setTimeout('$("ShopMessage").morph("opacity:0;");',3000);
		setTimeout('$("ShopMessage").style.display = "none";',4000);
	}
}

function sprawdz_formularz_sklepowy_TMP(AForm)
{    
	var j=1;
	
	for(i=0;i<10;i++)
	{	
		produkt = "Product"+i+"Order";
		item_sex = "Item"+i+"Sex";
		item_size = "Item"+i+"Size";
		item_amount = "Item"+i+"Amount";
		
		if(AForm[produkt])
		{
			if(AForm[produkt].checked)
			{
				box_id = i + "_sklep_order";
				n=0;
				for(k=0;k<10;k++)
				{
					item_sex = "Item"+n+"Sex";
					item_product_id = "Item"+n+"ProductId";
					if(AForm[item_sex].checked)
					{
						if(AForm[item_product_id].value == i)// jeżeli item_product_id = product_id
						{
							alert(n + " coś jest! - " + item_sex + " - " + AForm[item_product_id].value + "i="+i);
						}
						else
						{
					
							$('3_sklep_order').style.visibility = 'visible';
							$('3_sklep_order').style.border = '1px solid red;';
							alert("Co jest? Zaznaczyłeś że zamawiasz a nie zaznaczyłeś PĆI!");	
							scroll(0,400);
						}
					}
					n++;
				}
				
			}
			else
			{
				alert("FALSE " + i + " - " + produkt + " - " + AForm[produkt].checked);
			}
		}
		else
		{
			alert(produkt +" not exist");
		}
		j++;
	}
	return false;
		
        
}

function sprawdz_newsletter(AForm)
{
	if(AForm.NewsletterEmail.value == "email")
	{
            $('message').update("<div id='flashMessage' class='message'>Proszę podać e-mail</div>");
            showKontaktMessage();
            return false;
        }


	reg = /^[a-zA-Z0-9acelnószzACELNÓSZZ\.]{1,30}@[a-zA-Z0-9acelnószzACELNÓSZZ]+(\.[a-zA-Z0-9acelnószzACELNÓSZZ]+)+$/;
        wynik  = AForm.NewsletterEmail.value.match(reg);

        if (wynik  == null) {
            $('message').update("<div id='flashMessage' class='message'>Prosze podac poprawny adres email.</div>");
             showKontaktMessage();
            return false;
        }

        return true;
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function show_hide(id)
{
	t=document.getElementsByName('I'+id);
	count=t.length;
	for(i=0;i<count;i++) {

		if( t[i].style.display == 'none' )
		{
			t[i].style.display = 'block';
		}
		else
		{
			t[i].style.display = 'none';
		};
	}

}

function show(id)
{
	t=document.getElementsByName('I'+id);
	count=t.length;
	for(i=0;i<count;i++) {
			t[i].style.display = 'block';
	}

}

function hide(id)
{
	t=document.getElementsByName('I'+id);
	count=t.length;
	for(i=0;i<count;i++) {
			t[i].style.display = 'none';
	}

}

function boldFunc(id)
{
	t=document.getElementById('II'+id);
	t.style.color='#333';
	t.style.fontWeight='bold';
	t.style.background="";

}

function blueFunc(id)
{
	t=document.getElementById('II'+id);
	t.style.color='#0096FB';
}


