
function OpenSimple(modul) {
simplewindow = window.open('simple.php?modul='+modul, 'anew', config='height=410,width=410,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,directories=no,status=no');

 if(!simplewindow.closed)
   simplewindow.focus();  
}	

function OpenPhoto(nazwa,wys,szer, id) {
out=window.open('','Okno','left=40,top=40,width='+szer+',height='+wys+',innerheight='+wys+',innerwidth='+szer+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no')
out.document.write('<html><head>');
out.document.write('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">');
out.document.write('<title>/// VW Zone !! ///</title>');
out.document.write('<script language="javascript">');
out.document.write('</');
out.document.write('script>');
out.document.write('</head>');
out.document.write('<body bgcolor="white" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0">');
out.document.write('<div align="center"><a href="#" onclick="javascript:self.close();"><img src="'+nazwa+'" border="0" alt="Kliknij aby zamknąć" galleryimg="no" ondragstart="return false"></a></div>');
out.document.write('</body></html>');
out.focus();
}

function externalLinks() { 
 if (!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a"); 
 for (var i=0; i<anchors.length; i++) { 
   var anchor = anchors[i]; 
   if (anchor.getAttribute("href") && 
       anchor.getAttribute("rel") == "external") 
     anchor.target = "_blank"; 
 } 
} 
window.onload = externalLinks;

var theSelection = false;

var clientPC = navigator.userAgent.toLowerCase();
var clientVer = parseInt(navigator.appVersion);

var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
var is_nav  = ((clientPC.indexOf('mozilla')!=-1) && (clientPC.indexOf('spoofer')==-1)
                && (clientPC.indexOf('compatible') == -1) && (clientPC.indexOf('opera')==-1)
                && (clientPC.indexOf('webtv')==-1) && (clientPC.indexOf('hotjava')==-1));

var is_win   = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1));
var is_mac    = (clientPC.indexOf("mac")!=-1);

var Quote = 0;
var Bold  = 0;
var Italic = 0;
var Underline = 0;
var Code = 0;

function checkForm() {
	formErrors = false;    
	if (document.post.content.value.length < 2) {
		formErrors = "You must enter a content when posting";
	}
	if (formErrors) {
		alert(formErrors);
		return false;
	} else {
		//formObj.preview.disabled = true;
		//formObj.submit.disabled = true;
		return true;
	}
}

function emoticon(text) {
	text = ' ' + text + ' ';
	PostWrite(text);
}

function bbfontstyle(bbopen, bbclose) {
	if ((clientVer >= 4) && is_ie && is_win) {
		theSelection = document.selection.createRange().text;
		if (!theSelection) {
			document.post.content.value += bbopen + bbclose;
			document.post.content.focus();
			return;
		}
		document.selection.createRange().text = bbopen + theSelection + bbclose;
		document.post.content.focus();
		return;
	} else {
		document.post.content.value += bbopen + bbclose;
		document.post.content.focus();
		return;
	}
	storeCaret(document.post.content);
}

function storeCaret(textEl) {
	if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}

function PostWrite(text) {
	if (document.post.content.createTextRange && document.post.content.caretPos) {
		var caretPos = document.post.content.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?	text + ' ' : text;
	}
	else document.post.content.value += text;
	document.post.content.focus(caretPos)
}

function BBCcode() {
	if ((clientVer >= 4) && is_ie && is_win) {
		theSelection = document.selection.createRange().text;
		if (theSelection != '') {
		document.selection.createRange().text = "[code]" + theSelection + "[/code]";
		document.post.content.focus();
		return;
		}
	}
	if (Code == 0) {
		ToAdd = "[code]";
		document.post.code.value = "Kod*";
		Code = 1;
	} else {
		ToAdd = "[/code]";
		document.post.code.value = "Kod";
		Code = 0;
	}
	PostWrite(ToAdd);
}

function BBCquote() {
	if ((clientVer >= 4) && is_ie && is_win) {
		theSelection = document.selection.createRange().text;
		if (theSelection != '') {
		document.selection.createRange().text = "[quote]" + theSelection + "[/quote]";
		document.post.content.focus();
		return;
		}
	}
	if (Quote == 0) {
		ToAdd = "[quote]";
		document.post.quote.value = "Cytat*";
		Quote = 1;
	} else {
		ToAdd = "[/quote]";
		document.post.quote.value = "Cytat";
		Quote = 0;
	}
	PostWrite(ToAdd);
}

function BBCbold() {
	if ((clientVer >= 4) && is_ie && is_win) {
		theSelection = document.selection.createRange().text;
		if (theSelection != '') {
		document.selection.createRange().text = "[b]" + theSelection + "[/b]";
		document.post.content.focus();
		return;
		}
	}
	if (Bold == 0) {
		ToAdd = "[b]";
		document.post.bold.value = "B*";
		Bold = 1;
	} else {
		ToAdd = "[/b]";
		document.post.bold.value = "B";
		Bold = 0;
	}
	PostWrite(ToAdd);
}

function BBCitalic() {
	if ((clientVer >= 4) && is_ie && is_win) {
		theSelection = document.selection.createRange().text;
		if (theSelection != '') {
		document.selection.createRange().text = "[i]" + theSelection + "[/i]";
		document.post.content.focus();
		return;
		}
	}
	if (Italic == 0) {
		ToAdd = "[i]";
		document.post.italic.value = "i*";
		Italic = 1;
	} else {
		ToAdd = "[/i]";
		document.post.italic.value = "i";
		Italic = 0;
	}
	PostWrite(ToAdd);
}

function BBCunder() {
	if ((clientVer >= 4) && is_ie && is_win) {
		theSelection = document.selection.createRange().text;
		if (theSelection != '') {
		document.selection.createRange().text = "[U]" + theSelection + "[/U]";
		document.post.content.focus();
		return;
		}
	}
	if (Underline == 0) {
		ToAdd = "[u]";
		document.post.under.value = "U*";
		Underline = 1;
	} else {
		ToAdd = "[/u]";
		document.post.under.value = "U";
		Underline = 0;
	}
	PostWrite(ToAdd);
}

function BBCurl() {
	var FoundErrors = '';
	var enterURL   = prompt("Podaj URL", "http://");
	var enterTITLE = prompt("Podaj tytuł strony", "Tytuł strony");
	if (!enterURL)    {
		FoundErrors += " Nie podałeś URL'a!";
	}
	if (!enterTITLE)  {
		FoundErrors += " Nie podałeś tytułu strony!";
	}
	if (FoundErrors)  {
		alert("Informacja: "+FoundErrors);
		return;
	}
	var ToAdd = "[url="+enterURL+"]"+enterTITLE+"[/url]";
	document.post.content.value+=ToAdd;
	document.post.content.focus();
}

function BBCimg() {
	var FoundErrors = '';
	var enterURL   = prompt("Podaj URL obrazka","http://");
	if (!enterURL) {
		FoundErrors += " Nie podałeś URL obrazka!";
	}
	if (FoundErrors) {
		alert("Informacja: "+FoundErrors);
		return;
	}
	var ToAdd = "[img]"+enterURL+"[/img]";
	document.post.content.value+=ToAdd;
	document.post.content.focus();
}

var tid=new Array();var tt=new Array();var tc=new Array();var tk=new Array();var tcc=new Array();var to=new Array();var tl=new Array();
var liczba=6;var start=0;var koniec=liczba-1;var aktualny=start;
function pokaz(x){var ntid=tid[x];document.getElementById('nx_z').innerHTML=document.getElementById('news_content_'+ntid).innerHTML;document.getElementById('nx_l').innerHTML=tt[x];document.getElementById('nx_l').href=tl[x];document.getElementById('nx_o').alt=tt[x];document.getElementById('nx_o').src=to[x];document.getElementById('nx_c').innerHTML=tc[x];document.getElementById('nx_w').href=tl[x];document.getElementById('nx_k').href='/artykuly/'+tcc[x]+'_1/news.htm';document.getElementById('nx_k').innerHTML=tk[x];
for (i=0;i<=koniec;i++) {if (i==x) {document.getElementById('nx_lid'+i).className='hover';} else {document.getElementById('nx_lid'+i).className='';}}aktualny=x;}
function rotuj() {pokaz(aktualny);aktualny=aktualny+1;if (aktualny>koniec){aktualny=start;}}
function rotator_start(){rotator = setInterval("rotuj()",6000);}
function rotator_stop(){clearInterval(rotator);}
