function BannerTop()
{
	var embed_tag = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="728" height="90"><param name="movie" value="/media/728x90.swf"><param name="quality" value="high"><embed src="/media/728x90.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="728" height="90"></embed></object>';
	document.write(embed_tag);
}

function BannerLeft()
{
	var embed_tag = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="160" height="600"><param name="movie" value="/media/160x600.swf"><param name="quality" value="high"><embed src="/media/160x600.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="160" height="600"></embed></object>';
	document.write(embed_tag);
}

function zmien(id) {
	document.getElementById(id).style.display=(document.getElementById(id).style.display=='block')?'none':'block';
}
function go2URL(address)
{
  var elFrame = document.getElementById('doiFrame');
  elFrame.src = address;
}
function newWindow(address)
{
	var maxW = screen.width;
	var maxH = screen.height;
	var w = 800;
	var h = 600;
	var _top = Math.floor((maxH - h) / 2);
	var _left = Math.floor((maxW - w) / 2);
	
	var win = window.open(address,'doiW',"toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=yes,width="+w+",height="+h);
	win.moveTo(_left,_top);
	win.focus();
}

function Large1(poza,titlu,width,height)
{
	CreatePop(poza,titlu,width,height);
} 
var xx=new Object();
function CreatePop(poza,titlu,width,height)
{
	ttop=0;
	if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
		ttop=window.pageYOffset;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
		ttop=document.documentElement.scrollTop;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
		ttop=document.body.scrollTop;
	}
	
	if (width>myWidth-60) { width=myWidth-60;}
	if (height>myHeight-60) { height=myHeight-60;}
	
	l = (myWidth-width)/2;
	t = (myHeight-height-50)/2+ttop ; 
	
	//alert(myWidth+'    '+myHeight);
	
	var firefox = (navigator.appName=="Netscape")?'true':'false';
	
	xx=document.createElement("div");
	xx.innerHTML='<table><tr><td style="padding-top:7px; padding-left:10px;">'+titlu+'</td><td align="right" style="padding-top:7px; padding-right:10px;"><a href="javascript:ClosePop()" class="inchide">x Inchide</a></td></tr><td colspan="2" align="center"><img src="phpthumb/phpThumb.php?src=../'+poza+'&w='+width+'&h='+height+'" title='+titlu+'  alt='+titlu+' style="margin:10px"></td></tr></table>';
	xx.style.zIndex = '1000';	
	xx.style.backgroundColor = "transparent";  
	xx.style.position = "absolute";
	xx.style.border = "1px solid #666666";
	xx.style.left = l+'px';
	xx.style.top = t+'px';
	xx.style.backgroundColor='#FFFFFF';
	document.body.appendChild(xx);
	
} 
function ClosePop()
{
	xx.style.display = "none"; 
}
function szerokosc_okna(co){
		if (self.innerWidth){
			frameWidth = self.innerWidth;
		}
		else if (document.documentElement && document.documentElement.clientWidth) {
			frameWidth = document.documentElement.clientWidth;
		}
		else if (document.body){
			frameWidth = document.body.clientWidth;
		}
		else return;
		
		var szer_final;

		if(co == 'okno'){
			if(frameWidth > 966){
				szer_final = '980';
			}
			else{
				szer_final = '100%';
			}			
		}
		else if(co == 'szpalta'){
			if(frameWidth > 880){
				szer_final = '50%';
			}
			else{
				szer_final = '100%';
			}		
		}
		
		//alert(frameWidth);
		//alert(co);
		//alert(szer_final);
		
		return szer_final;
}

function jaka_szerokosc(){
		if (self.innerWidth){
			frameWidth = self.innerWidth;
		}
		else if (document.documentElement && document.documentElement.clientWidth) {
			frameWidth = document.documentElement.clientWidth;
		}
		else if (document.body){
			frameWidth = document.body.clientWidth;
		}
		else{
			frameWidth = 1000;
		}

		return frameWidth;
}

function openNonscrolledWindow(theURL,winName,myWidth, myHeight, isCenter) { 
  if(window.screen)
	if(isCenter)
		if(isCenter=="true")
		{	var myLeft = (screen.width-myWidth)/2;
    			var myTop = (screen.height-myHeight)/2;
		window.open(theURL,winName,'location=0,directories=0,scrollbars=no,toolbar=0,menubar=0,resizable=0,status=0,width='+myWidth+',height='+myHeight+',left=' + myLeft+ ',top=' + myTop)
  }																		  
}

function openscrolledWindow(theURL,winName,myWidth, myHeight, isCenter) { 
  if(window.screen)
	if(isCenter)
		if(isCenter=="true")
		{	var myLeft = (screen.width-myWidth)/2;
    			var myTop = (screen.height-myHeight)/2;
		window.open(theURL,winName,'location=0,directories=0,scrollbars=yes,toolbar=0,menubar=0,resizable=1,status=0,width='+myWidth+',height='+myHeight+',left=' + myLeft+ ',top=' + myTop)
  }																		  
}

function wyniki_ankiety(theURL, winName, myWidth, myHeight) { 
	window.open(theURL,winName,'location=0,directories=0,scrollbars=yes,toolbar=0,menubar=0,resizable=1,status=0,width='+myWidth+',height='+myHeight+',left=200 ,top=100')
}

function bookmarkit(){
	if (document.all){	
		window.external.addFavorite('http://www.transazja.pl','transAzja.pl - wszystko o Azji');
	}

}

function sprawdz_st_klient(){
	var f = document.formularz;
	if (f.st_klient.checked == true && f.partner_ID.value == "") {
		f.partner_ID.value = '000';
	}
	if (f.st_klient.checked == false && f.partner_ID.value == '000') {
		f.partner_ID.value = '';
	}
}

function checkCheckPP(f){
	if (f.prod.checked == false ) {
		alert('Musisz wyrazić zgodę na przetważanie danych osobowych.');
		return false;
	}
	if (f.prod2.checked == false ) {
		alert('Musisz zaakceptować warunki regulaminu.');
		return false;
	}	
	//if (f.biuletyn.checked == false ) {
		//return confirm('Czy ¶wiadomie nie została zaznaczona opcja zgłoszenia chęci otrzymywania transAzja Biuletynu?');
	//}	
}

function checkFormZapisu(f){

	if(f.imie.value == "")	{
		alert("Campul prenumele trebuie neaparat completat. Va rugam sa verificati si sa completati acest camp.");
		return false;
	}
	
	if(f.nazwisko.value == "")	{
		alert("Campul Numele trebuie neaparat completat. Va rugam sa verificati si sa completati acest camp.");
		return false;
	}
	
	if (f.telefon.value == ""){
		alert("Campul Telefon fix trebuie sa contina doar numere, fara spatii, puncte, linii sau alte elemente de spatiere.");
		return false;
	}

	numer = f.telefon.value;
	if(isNaN(numer)) {
		alert("Campul Telefon fix trebuie sa contina doar numere, fara spatii, puncte, linii sau alte elemente de spatiere.");
		return false;	
	}
	
	if (f.tel_kom.value == ""){
		alert("Campul Telefon mobile trebuie sa contina doar numere, fara spatii, puncte, linii sau alte elemente de spatiere.");
		return false;
	}

	numer2 = f.tel_kom.value;
	if(isNaN(numer2)) {
		alert("Campul Telefon mobil trebuie sa contina doar numere, fara spatii, puncte, linii sau alte elemente de spatiere.");
		return false;	
	}	

	if (f.email.value=='') {
		alert('Va rugam verificati daca ati introdus adresa de email in mod corect.');
		return false;
	}

	if ( ((f.email.value.indexOf('@',1))==-1)||(f.email.value.indexOf('.',1))==-1 ) {
		alert('Va rugam verificati daca ati introdus adresa de email in mod corect.');
		return false;
	}	
	
	//if (f.program[0].selected == true ) {
	//	alert('Campul Alege aria de interes trebuie neaparat completat. Va rugam sa verificati si sa completati acest camp.');
	//	return false;	
	//}

	if ( (f.program[0].selected == true) && (f.akcja[0].checked == true) && (f.uwagi.value == "") ) {
		alert('Campul Mentiuni / Intrebari trebuie neaparat completat. Va rugam sa verificati si sa completati acest camp.');
		return false;	
	}	

	if ( (f.program[0].selected == false) && (f.uwagi.value == "") ) {
		alert('Campul Mentiuni / Intrebari trebuie neaparat completat. Va rugam sa verificati si sa completati acest camp.');
		return false;	
	}		
	
	if ( (f.program[0].selected == true) && (f.akcja[1].checked == true) && (f.ulica.value == "") ) {
		alert('Campul Strada si numarul trebuie neaparat completat. Va rugam sa verificati si sa completati acest camp.');
		return false;	
	}		

	if ( (f.program[0].selected == true) && (f.akcja[1].checked == true) && (f.ulica.value == "") ) {
		alert('Campul Strada si numarul trebuie neaparat completat. Va rugam sa verificati si sa completati acest camp.');
		return false;	
	}
	
	if ( (f.program[0].selected == true) && (f.akcja[1].checked == true) && (f.numer_domu.value == "") ) {
		alert('Campul Bloc, apartament, etaj etc. trebuie neaparat completat. Va rugam sa verificati si sa completati acest camp.');
		return false;	
	}	

	if ( (f.program[0].selected == true) && (f.akcja[1].checked == true) && (f.lokal.value == "") ) {
		alert('Campul Oras trebuie neaparat completat. Va rugam sa verificati si sa completati acest camp.');
		return false;	
	}		
	
	if ( (f.program[0].selected == true) && (f.akcja[1].checked == true) && (f.kod_pocztowy.value == "") ) {
		alert('Campul Cod postal trebuie neaparat completat. Va rugam sa verificati si sa completati acest camp.');
		return false;	
	}	
	
	if ( (f.program[0].selected == true) && (f.akcja[1].checked == true) && (f.miasto.value == "") ) {
		alert('Campul Judet/sector trebuie neaparat completat. Va rugam sa verificati si sa completati acest camp.');
		return false;	
	}		

}

function ukryj(id) {
	document.getElementById(id).style.display='none';
}

function odkryj(id) {
	document.getElementById(id).style.display='block';
}

function sprawdz_program(the_form, nazwa_pola, i){

	if (document.forms[the_form].elements[nazwa_pola][0].selected == true ) {
		odkryj('1');
		document.forms[the_form].elements['akcja'][0].checked = true;
	}
	else{
		ukryj('1');
		ukryj('rejestracja');	
		document.forms[the_form].elements['akcja'][0].checked = true;	
	}
	
	return true;
}

function sprawdz_kontakt(the_form, nazwa_pola, i){

	if (document.forms[the_form].elements[nazwa_pola][6].selected == true ) {
		alert('UWAGA! Wybranie tej opcji oznacza, że wszystkie sprawy będ± z Tob± załatwiane poprzez e-maila, pocztę lub telefon przez centralę w Warszawie');
	}
	
	return true;
}

function ankieta_sprawdz_form(the_form, nazwa_pola, i){

	for(a=0; a<i; a++){
		if (document.forms[the_form].elements[nazwa_pola][a].checked == true ) {
			return true;
		}
	}

	alert('sonda transAzja.pl: Nie wybrano opcji');
	return false;
}


function biuletyn_check(){
	if (document.formularz.biuletyn.checked == true ) {
		if(confirm('Czy jeste¶ zdecydowany zrezygnować z otrzymywania transAzja Biuletyn?')){
			document.formularz.biuletyn.checked = false;
		} 
		else{
			document.formularz.biuletyn.checked = true;
		}
	}	
}


function zaznAll(the_form, nazwa_pola, akcja) {
	for (var i=0; i<document.forms[the_form].elements[nazwa_pola].length; i++)  {
		document.forms[the_form].elements[nazwa_pola][i].checked = akcja;			
	}
}

function openpopup(){
	winpops=window.open(popurl,"popup","width=450,height=180,screenX=150,screenY=150,top=150,left=150")
}

function get_cookie(Name) {
//this function is used only if variable "poponce" above is set to "true"
 var search = Name + "="
 var returnvalue = "";
 //alert(document.cookie.length);
 if (document.cookie.length > 0) {
   offset = document.cookie.indexOf(search)
   if (offset != -1) { // if cookie exists
     offset += search.length
     // set index of beginning of value
     end = document.cookie.indexOf(";", offset);
     // set index of end of cookie value
     if (end == -1)
        end = document.cookie.length;
        returnvalue=unescape(document.cookie.substring(offset, end))
     }
  }
 return returnvalue;
}

function loadpopup(){
// if (status=="true") { // if popups turned on
 // if (get_cookie('alreadypopped')==''){ // and cookie not set
   openpopup() // then show popup
//   if (poponce=="true") { // if popup once only required
//     document.cookie="alreadypopped=yes" // then set a cookie
//     }
//   }
  // cookie is already set; so do nothing
// }
}


/*
function load_toplayer(){
// if (status=="true") { // if popups turned on
  //alert(get_cookie('alreadypopped'));
  
  if (get_cookie('alreadypopped')==''){ // and cookie not set
	   open_toplayer()
	  
	   if (poponce=="true") { // if popup once only required
		 document.cookie="alreadypopped=yes" // then set a cookie
	   }
  }
  // cookie is already set; so do nothing
// }
}*/

function pokaz_toplayer(){
	document.getElementById("toplayer").style.display='block';
}

function zamknij_reklame(){
	document.getElementById("toplayer").style.display='none';
}

