/*funkce*/

/*tidyname - vycisti vstupni text, takk aby se dal pouzit jako 
"name" pro window.open*/
function mpc_tidyname(toclear)
{
	var dirtyname=toclear; //url ktera se ma zobrazit
	re=new RegExp("(http)|([:\?\.&@%=+-\/]|(\s))","gi"); //def regexpu - g-lobal (resp. greedy), i-gnore case
	var tidyname=dirtyname.replace(re, ''); //nazev okna, tj. URL s vyhazenymi nezadoucimi znaky
	return tidyname;
};

/*urlopen - otevre URL do noveho okna (obsahuje jiz de facto fci "tidyname"*/
function mpc_urlopen(url)
{
	var urlreal=url; //url ktera se ma zobrazit
	re=new RegExp("(http)|([:\?\.&@%=+-\/]|(\s))","gi"); //def regexpu - g-lobal (resp. greedy), i-gnore case
	var urlname=urlreal.replace(re, ''); //nazev okna, tj. URL s vyhazenymi nezadoucimi znaky
	window.open(url,urlname);
	return 0;
}

/*
viewImg - zobrazí nové okno s obrázkem a jeho popisem, resp. zavolá .php
s temito parametry
(!vyzaduje fci "tidyname")
*/
function mpc_viewImg(ident,description)
{
	mwidth=730;
	mheight=(screen.height)-100;
	url=basicurl+"viewImg.php?content="+ident+"&description="+description;
	window.open(url,
	tidyname(ident),
	"width="+mwidth+",height="+mheight+","+
	"left=10, top=10,"+
	"toolbar=no,location=no,directories=no,status=no,menubar=no,"+
	"resizable=yes,scrollbars=yes"
	);
	return 0;
}

/*
mpc_nw - nahrazeni target=_blank pro xhtml
*/

function mpc_nw(targetlocation)
{
	return window.open(targetlocation);
};
/*


*/

function vytisknoutstranku()
{
	document.write(' &nbsp;|&nbsp; <a title="Vytisknout stránku" href="#" onclick="window.print();return false;">Vytisknout</a>'); 
};

/*
Ochrana proti opakovanému odeslání
*/

	var formerrormsg="Formulář se již odesílá."
	
	function checksubmit(submitbtn){
	submitbtn.form.submit()
	checksubmit=blocksubmit
	return false
	}
	
	function blocksubmit(){
	if (typeof formerrormsg!="undefined")
	alert(formerrormsg)
	return false
	}


/*
viewSnapshot
*/


function viewSnapshot(ident)
{
	mwidth=730;
	mheight=(screen.height)-100;
	basicurl="http://webtan.pavucina.com/";
	url=basicurl+"viewSnapshot.php?content="+ident;
	window.open(url,
	ident,
	"width="+mwidth+",height="+mheight+","+
	"left=10, top=10,"+
	"toolbar=no,location=no,directories=no,status=no,menubar=no,"+
	"resizable=yes,scrollbars=yes"
	);
	return 0;
}