$(document).ready(function () {
	tmp = this.location.href.split('#');
	if (tmp[1]) $('div#l_'+tmp[1]).fadeIn();
	 
	 $('div.MiniaturkiGalerii a').lightBox();
	
	 $('a.klikaj').click(function () {
			tmp = this.href.split('#');
		 	if ($('div#l_'+tmp[1]+':visible').html()) $('div#l_'+tmp[1]).fadeOut();
		 	else $('div#l_'+tmp[1]).fadeIn();
		 	});
});

function external(path) { // pass in the correct path to the function so we only need one  for infinite amount of calls from  flash
	// if the lightbox does not exist we will make it
	if ($('a#lightbox').length == 0) {
		$("body").append("");
		$('a#lightbox').lightBox();
		// if it already exists but the path is different we will set the new path
	} else if ($('a#lightbox').attr("href") != path) {
		$('a#lightbox').attr("href", path);
	}
	// now we will simulate the click here.
	$('a#lightbox').trigger("click");
}

function isEmail(email) {
	email = email.replace(/[ ]/g,'');
	var regEmail = /^([a-zA-Z0-9._-]{1,})@([a-zA-Z0-9._-]{1,})\.([a-zA-Z]{2,4})$/;
	if (!regEmail.test(email)) return false;
	else return email;
	}
