function mail(co) 
{ 
	Wzor=/^[0-9a-zA-Z-.]+\@[0-9a-zA-Z-]+\.[0-9a-zA-Z-.]+$/; 
	OK=(Wzor.test(document.form.elements[co].value)==true && document.form.elements[co].value.length!=0); 
	if(OK==false)
	{
		alert("podaj poprawny adres");
		document.form.elements[co].focus();
		return false;
	}
	else
	{
	return true;
	}

}
function ustawRysunek(nazwaRys, typ)
{
	if(document.images) 
		{


		if( typ == "wyrozniony") 
			{
			document.images[nazwaRys].src = rysunkiWyroznione[nazwaRys].src;
			return true;
			} 
		else if ( typ == "zwykly" ) 
			{
			document.images[nazwaRys].src = rysunkiZwykle[nazwaRys].src;
			return true;
			}

		}
	return false;
}

function trzyZnaki(){
	//document.myform.F_SZUKAJ.value = document.myform.F_SZUKAJ.value.toUpperCase();
	if(document.myform.F_SZUKAJ.value.length<3) 
		{
		alert('min. 3 znaki');
		document.myform.F_SZUKAJ.focus();
		return false;
		}
	else
		{
		return true;
		}
}

function mapaSzukaj()
{
	if(document.stopkaForm.FS_SZUKAJ.value.length<3) 
		{
		alert('min. 3 znaki');
		document.stopkaForm.FS_SZUKAJ.focus();
		return false;
		}
	else
		{
		return true;
		}
}

function podglad( skrypt )
{
	var okno_width = parseInt((screen.availWidth)-8);
	var okno_height =  parseInt((screen.availHeight)-8);
	var left_corner = 0;
	var top_corner = 0;
	var cechy_okna = "width=" + okno_width + ", height=" + okno_height + ", left=" + left_corner + ", top=" + top_corner + ", menubar=no, status=no, scrollbars=yes";

	myString = new String( document.form.elements['F_TRESC'].value );
	newString = new String( "<br>" );
	rExp = /\r\n/g;
	document.form.elements['F_TRESC'].value = myString.replace(rExp, newString );	

	window.open('/kartki/' + skrypt + '.php', 'podglad', cechy_okna);
	document.form.target='podglad';
	document.form.action='/kartki/' + skrypt + '.php';
}

function wyslij( co )
{
	document.form.target='_self';
	document.form.action='/kartki/wyslij.php';
}

function wyslij_link(link)
{
	var okno_width = 400;
	var okno_height = 240;
	var left_corner = window.screenLeft + parseInt((document.body.clientWidth - okno_width)/2);
	var top_corner = window.screenTop + parseInt((document.body.clientHeight - okno_height)/2) - 100;
	var cechy_okna = "width=" + okno_width + ", height=" + okno_height + ", left=" + left_corner + ", top=" + top_corner + ", menubar=no, status=no, scrollbars=no";
	window.open('wyslij_link.php?' + link, 'wyslij', cechy_okna);
	//alert( window.screenLeft + '|' + window.screenTop + '||' + document.body.clientWidth + '||' + document.body.clientHeight);
}

function zapomnialem_haslo()
{
	var okno_width = 400;
	var okno_height = 280;
	var left_corner = window.screenLeft + parseInt((document.body.clientWidth - okno_width)/2);
	var top_corner = window.screenTop + parseInt((document.body.clientHeight - okno_height)/2) - 100;
	var cechy_okna = "width=" + okno_width + ", height=" + okno_height + ", left=" + left_corner + ", top=" + top_corner + ", menubar=no, status=no, scrollbars=no";
	window.open('haslo.html', 'haslo', cechy_okna);

}

function drukuj()
{
	var host = document.domain;
	var adres_url = document.URL;
	var adres = adres_url.split(host);
	var okno_width = 570;
	var okno_height = document.body.clientHeight-20;
	var left_corner = window.screenLeft + parseInt((document.body.clientWidth - okno_width)/2);
	var top_corner = window.screenTop + parseInt((document.body.clientHeight - okno_height)/2) - 100;
	var cechy_okna = "width=" + okno_width + ", height=" + okno_height + ", left=" + left_corner + ", top=" + top_corner + ", menubar=yes, status=no, scrollbars=yes";
	window.open('http://www.planete.pl/drukuj_artykul.php?' + adres[1], 'wyslij', cechy_okna);
	
}

function dealerSzukaj(a)
{
	document.myform.action=a;
	document.myform.submit();
}

function dealerMiasto(a)
{
	document.myform.F_MIASTO.value=a;
	document.myform.submit();
}

//=========================================================

function zwiastun(id){
	if(!id) {return false;}
	var obj_post = new Object();
	obj_post['F_id'] = id;
	$("div#premiery500").html('<div style="height:482px;">...czekaj...</div>');	
	
	var url = 'http://' + window.location.hostname + '/php/zwiastuny500.php';

	$.post(url, obj_post, 
		   function(data){
			   $("div#premiery500").html(data);
			   });
	
	return false;
}

//=========================================================

function mainZwiastun(id, auto){
	if(!id) {return false;}
	var obj_post = new Object();
	obj_post['F_id'] = id;
	if(auto) obj_post['F_auto'] = auto;
	$("div#premiery500").html('<div style="height:302px;">...czekaj...</div>');	
	
	var url = 'http://' + window.location.hostname + '/php/zwiastuny_main.php';

	$.post(url, obj_post, 
		   function(data){
			   $("div#mainWideoPlayer").html(data);
			   });
	
	return false;
}

//=========================================================

function zwiastunyInne(id){
	if(!id) {return false;}
	var obj_post = new Object();
	obj_post['F_id'] = id;
	$("div#zwiastunyInne").html('<div style="height:320px;">...czekaj...</div>');
	
	var url = 'http://' + window.location.hostname + '/php/zwiastuny_inne.php';
	
	$.post(url, obj_post, 
		   function(data){
			   $("div#zwiastunyInne").html(data);
			   });	
	
	return false;
}

//=======================================================
function wiecej()
{
	fstrona = document.createElement("input");
	fstrona.setAttribute('style', 'display:none');
	fstrona.setAttribute('type', 'text');
	fstrona.setAttribute('name', 'F_strona');
	fstrona.setAttribute('id', 'F_strona');
	fstrona.setAttribute('value', '1');
	document.getElementById('formTVSzukaj').appendChild(fstrona);
	document.getElementById('formTVSzukaj').submit();
}
//======================================================
