function popBanner( Title, W,H, Type, Contents ){
    
	if(Type=='swf'){	
		var theWin ="<div id='bannerPopup' class='bannerPopupSwf'>"+Contents+"</div>";
	}
	else{
		var theWin ="<div id='bannerPopup' class='bannerPopupImg'><div id='bannerPopupClose'><a href='javascript:closePopup()'>x</a></div><div id='bannerContent'>"+Contents+"</div></div>";
	}
	var width = W;
	var height = H;
	var windowHeight = getVisibleHeight();
	document.write(theWin);
	//littleWin.focus();
	if (document.documentElement && document.documentElement.scrollTop)	 theTop = document.documentElement.scrollTop;
	else theTop = document.body.scrollTop;	
	
	var objTop = (theTop+(windowHeight/2)-(height/2)-45);
	var objLeft = (document.body.scrollLeft+((document.body.clientWidth)/2)-(width/2)-5);
	o('bannerPopup').style.left = objLeft+'px';
	
	//var slide4 = new Spry.Effect.Slide('bannerPopup', {duration: 2000, from: '0px', to: '300px', toggle: true});
	
	if(o('bannerContent')){
		var effect2 = new Spry.Effect.Slide("bannerContent",{from: "0%", to: "100%", duration: 1000, toggle: true, transition: Spry.circleTransition, fps: 60});
  		effect2.start();
	}
	
	var fromPos = new Spry.Effect.Utils.Position();
	fromPos.x = objLeft;
	fromPos.y = 0;
	
	var toPos = new Spry.Effect.Utils.Position();
	toPos.x = objLeft;
	toPos.y = objTop;
	
	Spry.Effect.makePositioned(document.getElementById("bannerPopup"));
	var move_effect = new Spry.Effect.Move("bannerPopup", fromPos, toPos, {duration: 1000, toggle: true, transition: Spry.circleTransition, fps: 60 });
	move_effect.start();
	//o('bannerPopup').style.top = (theTop+(windowHeight/2)-(height/2)-45)+'px';	
	//o('bannerPopup').style.left = (document.body.scrollLeft+((document.body.clientWidth)/2)-(width/2)-5)+'px';
}

function closePopup(){
	o('bannerPopup').style.display = "none";
}

function o(identyfikator) {
	return document.getElementById(identyfikator);
}



function getVisibleHeight(Width, Height) {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  return myHeight;
}



function openPage(theUrl,W,H){
    var theWin ="'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width="+W+",height="+H+"'"
	littleWin = window.open(theUrl,'',theWin);
	//littleWin.resizeTo(W+10,H+29);
 	littleWin.focus();
}

function doEmail(){
	
}

function newsletterAdd(){
	
	var form = document.forms['form_newsletter'];
	var email = form.newsletter_email.value;
	
	if(validateEmail(email)){
		form.form_type.value = 'add';
		form.submit();
	}
	else{
		alert('Niepoprawny adres e-mail');
	}
}


function newsletterDel(){
	
	var form = document.forms['form_newsletter'];
	var email = form.newsletter_email.value;
	
	if(validateEmail(email)){
		form.form_type.value = 'del';
		form.submit();
	}
	else{
		alert('Niepoprawny adres e-mail');
	}
}


/*********************************************************/
/* Web Pages Menu                                        */
/*********************************************************/

function showSubMenu(obj){

	var selectObj = document.getElementById( obj );
	if (selectObj==null)	return;
	
	if (selectObj.style.display != ""){
		//alert('tak');
		selectObj.style.display = "";
	}
	else 
		selectObj.style.display = "none";
	
	return;
}

function showMapMenu(obj){

	var selectObj = document.getElementById( obj );
	if (selectObj==null)	return;
	
	if (selectObj.style.display != ""){
		//alert('tak');
		selectObj.style.display = "";
	}
	else 
		selectObj.style.display = "none";
	
	return;
}

function hideSubMenu(obj){
	
	if ( obj!="" ){
		var selectObj = document.getElementById( obj );

		if (selectObj != null)
			selectObj.style.display = "none";
	}
}

function highSubItem(obj){
	
	if ( obj!="" ){
		var selectObj = document.getElementById( obj );

		if (selectObj != null){
			if(selectObj.className=='menu_i')
				selectObj.className='menu_a';
				
			if(selectObj.className=='menu_si')
				selectObj.className='menu_sa';
				
			if(selectObj.className=='menu_top_i')
				selectObj.className='menu_top_a';
		}
	}
}

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 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 validateEmail(string) {
	
	if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
		return true;
	else
	return false;
}



function sendFormChecked(objname){
	var obj = document.forms[objname];
	for(var i=0; i<obj.elements.length;i++){
		if(obj.elements[i].value == tabdefvalues[i] || obj.elements[i].value == ''){
			obj.elements[i].value =''	
		}
	}
	sendFormRight();
	
}
