var newwindow;

function poptastic(page)
{
newwindow=window.open(page,'name','height=550,width=420,left=20,top=20,toolbar=no,menubar=no,directories=no,location=no,scrollbars=yes,status=no,resizable=yes,fullscreen=no');
if (window.focus) {newwindow.focus()}
}

function poptastic800600(page)
{
	if (newwindow != null)
		newwindow.close();
	var	pic_width		= document.getElementById("pic_width").value;
	var	pic_height	= document.getElementById("pic_height").value;
	LeftPosition=50;TopPosition=50;
	settings='width='+pic_width+',height='+pic_height+',top='+TopPosition+',left='+LeftPosition+',scrollbars=no,location=no,directories=no,status=yes,menubar=no,toolbar=no,resizable=no';
	newwindow=window.open(page,'',settings);
	newwindow.resizeTo(pic_width,pic_height);
	newwindow.window.focus();
}

function poptastic800600old(page)
{
	var	pic_width		= document.getElementById("pic_width").value;
	var	pic_height	= document.getElementById("pic_height").value;

newwindow=window.open(page,'name','width='+pic_width+',height='+pic_height+',left=110,top=60,toolbar=no,menubar=no,directories=no,location=no,scrollbars=no,status=no,resizable=no,fullscreen=no');
if (window.focus) {newwindow.focus()}
	win.resizeTo(pic_width,pic_height);
}

function poptasticwh(page,winwidth,winheight,leftdist,topdist)
{
newwindow=window.open(page,'name','width='+winwidth+',height='+winheight+',left='+leftdist+',top='+topdist+',toolbar=no,menubar=no,directories=no,location=no,scrollbars=no,status=no,resizable=no,fullscreen=no');
if (window.focus) {newwindow.focus()}
}

function Enlarge(cur_image,lar_image,lar_width,lar_height)
{
	document.getElementById("main_content").style.display = "none";
	document.getElementById("image_content").style.display = "inline";
	document.getElementById("flash_content").style.display = "none";

	document.getElementById("picture").style.display = "none";
	document.getElementById("loader").style.display = "inline";

	document.getElementById("picture").src				= cur_image;
	document.getElementById("large_image_href").href	= lar_image;
}

//function EnlargeFlash(flash_no)
//{
//	var current_flash			= document.getElementById("current_flash").innerHTML;
//	document.getElementById("main_content").style.display = "none";
//	document.getElementById("image_content").style.display = "none";
//	document.getElementById("flash_content").style.display = "inline";
//
//	if (current_flash != '')
//		document.getElementById("flash_movie_"+current_flash).style.display = "none";
//
//	document.getElementById("flash_movie_"+flash_no).style.display = "inline";
//	document.getElementById("current_flash").innerHTML = flash_no;
//}

function EnlargeFlash(flash_name)
{
	document.getElementById("main_content").style.display = "none";
	document.getElementById("image_content").style.display = "none";
	document.getElementById("flash_content").style.display = "inline";

	document.getElementById("play_current_flash").innerHTML = '<object width="400" height="320" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"><param name="flashvars" id="flash_param" value="file=/videos/' + flash_name + '&autostart=1&backcolor=0xEEEEEE&frontcolor=0x333333&lightcolor=0xFFFFFF"><param name="movie" value="video/flvplayer.swf"><param name="allowfullscreen" value="true"><embed src="video/flvplayer.swf" width="400" height="320" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" allowfullscreen="true" id="flash_embed" flashvars="file=/videos/' + flash_name +'&autostart=1&backcolor=0xEEEEEE&frontcolor=0x333333&lightcolor=0xFFFFFF"></object>';
}

function Change()
{
	document.getElementById("loader").style.display = "none";
	document.getElementById("picture").style.display = "inline";
}
function border(object,object1)
{
	document.getElementById(object).style.border='solid thin #ff6600';
	document.getElementById(object1).style.border='none';
}
function reg()
{
	var	errors					= '';
	var check						= document.registracija;
	if (check.jmbg.value.length < 2)
		errors					= errors + '<br>- Popunite polje JMBG';
	else
	{
		if (check.jmbg.value.length != 13)
		errors					= errors + '<br>- JMBG je neispravan';
	}
	if (check.email.value.length < 2)
	{
		errors					= errors + '<br>- Popunite polje email';
	}
	else
	{
		if (checkemail(check.email.value) != true)
		errors					= errors + '<br>- Email koje ste uneli je neispravno.';
	}


	if (errors != '')
	{
		$.prompt("Molim ispravite sledece greške da biste mogli poslati vaš zahtev:" + errors);

	} 
	else
	check.submit();
}
function checkemail(str)
{
	var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	if (filter.test(str))
		return true;
	else
		return false;
}

