<!--
var t;
function schovej () {
	if (document.getElementById) {
		document.getElementById('admin').style.visibility = 'hidden';
//		document.getElementById('archiv').style.visibility = 'hidden';
		document.getElementById('vlastni').style.visibility = 'hidden';
//		document.getElementById('vysledky').style.visibility = 'hidden';
	}
	else
		alert('Your browser does not support this function');
}

function ukaz (menu) {
	schovej ();
	if (document.getElementById)
		document.getElementById(menu).style.visibility = 'visible';
	else
		alert('Your browser does not support this function');
}

function RemKamp(id,faze) {
	if (confirm('Do you really wish to delete this campaign?')) window.location.href='kampan.php?action=delete&idkampan=' + id
}

if(document.images){  // preload images
	nav01 = new Image; nav01.src = "img/icon_tv.gif"
	nav01h = new Image; nav01h.src = "img/icon_tv_h.gif"
	nav01v = new Image; nav01v.src = "img/icon_tv_v.gif"
	nav02 = new Image; nav02.src = "img/icon_radio.gif";
	nav02h = new Image; nav02h.src = "img/icon_radio_h.gif";
	nav02v = new Image; nav02v.src = "img/icon_radio_v.gif";
	nav03 = new Image; nav03.src = "img/icon_print.gif";
	nav03h = new Image; nav03h.src = "img/icon_print_h.gif";
	nav03v = new Image; nav03v.src = "img/icon_print_v.gif";
	nav04 = new Image; nav04.src = "img/icon_mail.gif";
	nav04h = new Image; nav04h.src = "img/icon_mail_h.gif";
	nav04v = new Image; nav04v.src = "img/icon_mail_v.gif";
	nav04 = new Image; nav04.src = "img/icon_mail.gif";
	nav04h = new Image; nav04h.src = "img/icon_mail_h.gif";
	nav04v = new Image; nav04v.src = "img/icon_mail_v.gif";
	nav05 = new Image; nav05.src = "img/icon_inet.gif";
	nav05h = new Image; nav05h.src = "img/icon_inet_h.gif";
	nav05v = new Image; nav05v.src = "img/icon_inet_v.gif";
	nav06 = new Image; nav06.src = "img/icon_face.gif";
	nav06h = new Image; nav06h.src = "img/icon_face_h.gif";
	nav06v = new Image; nav06v.src = "img/icon_face_v.gif";
	nav07 = new Image; nav07.src = "img/icon_sales.gif";
	nav07h = new Image; nav07h.src = "img/icon_sales_h.gif";
	nav07v = new Image; nav07v.src = "img/icon_sales_v.gif";
	nav08 = new Image; nav08.src = "img/icon_design.gif";
	nav08h = new Image; nav08h.src = "img/icon_design_h.gif";
	nav08v = new Image; nav08v.src = "img/icon_design_v.gif";
  nav09 = new Image; nav09.src = "img/icon_face.gif";
	nav09h = new Image; nav09h.src = "img/icon_face_h.gif";
	nav09v = new Image; nav09v.src = "img/icon_face_v.gif";


}

function flash(imageName,imageFile) {
	if(!document.images) return;
	eval('document.images[imageName].src = '+imageFile+'.src');
}
function kategor() {
/*ZRUSENO
  var frm = document.all;
  var katka = frm.kategorie.options[frm.kategorie.selectedIndex].value;

  document.all.item("xa_tym").style.visibility = 'hidden';
  document.all.item("xa_tym").style.display = 'none';
  document.all.item("xb_tym").style.visibility = 'hidden';
  document.all.item("xb_tym").style.display = 'none';
  document.all.item("xc_tym").style.visibility = 'hidden';
  document.all.item("xc_tym").style.display = 'none';
  document.all.item("xd_tym").style.visibility = 'hidden';
  document.all.item("xd_tym").style.display = 'none';
  document.all.item("xe_tym").style.visibility = 'hidden';
  document.all.item("xe_tym").style.display = 'none';
  document.all.item("xf_tym").style.visibility = 'hidden';
  document.all.item("xf_tym").style.display = 'none';
  document.all.item("xg_tym").style.visibility = 'hidden';
  document.all.item("xg_tym").style.display = 'none';
  document.all.item("xh_tym").style.visibility = 'hidden';
  document.all.item("xh_tym").style.display = 'none';
  document.all.item("xi_tym").style.visibility = 'hidden';
  document.all.item("xi_tym").style.display = 'none';
  document.all.item("xj_tym").style.visibility = 'hidden';
  document.all.item("xj_tym").style.display = 'none';

  if (katka != 3) {
     document.all.item("subka").style.visibility = 'hidden';
     document.all.item("subka").style.display = 'none';

     if (document.all.item("subka2")) {
	  document.all.item("subka2").style.visibility = 'hidden';
	  document.all.item("subka2").style.display = 'none';
      }
  }

 if (katka == 1)    {
    document.all.item("xa_tym").style.visibility = 'visible';
    document.all.item("xa_tym").style.display = '';
    document.all.item("xb_tym").style.visibility = 'visible';
    document.all.item("xb_tym").style.display = '';
    document.all.item("xc_tym").style.visibility = 'visible';
    document.all.item("xc_tym").style.display = '';
    document.all.item("xd_tym").style.visibility = 'visible';
    document.all.item("xd_tym").style.display = '';
    document.all.item("xe_tym").style.visibility = 'visible';
    document.all.item("xe_tym").style.display = '';
    document.all.item("xf_tym").style.visibility = 'visible';
    document.all.item("xf_tym").style.display = '';
    document.all.item("xg_tym").style.visibility = 'visible';
    document.all.item("xg_tym").style.display = '';
    document.all.item("xh_tym").style.visibility = 'visible';
    document.all.item("xh_tym").style.display = '';
 }
 else if (katka == 2)     {
    document.all.item("xa_tym").style.visibility = 'visible';
    document.all.item("xa_tym").style.display = '';
    document.all.item("xb_tym").style.visibility = 'visible';
    document.all.item("xb_tym").style.display = '';
    document.all.item("xc_tym").style.visibility = 'visible';
    document.all.item("xc_tym").style.display = '';
    document.all.item("xf_tym").style.visibility = 'visible';
    document.all.item("xf_tym").style.display = '';
    document.all.item("xg_tym").style.visibility = 'visible';
    document.all.item("xg_tym").style.display = '';
    document.all.item("xh_tym").style.visibility = 'visible';
    document.all.item("xh_tym").style.display = '';
 }
 else if (katka == 3)     {
    document.all.item("xa_tym").style.visibility = 'visible';
    document.all.item("xa_tym").style.display = '';
    document.all.item("xb_tym").style.visibility = 'visible';
    document.all.item("xb_tym").style.display = '';
    document.all.item("xc_tym").style.visibility = 'visible';
    document.all.item("xc_tym").style.display = '';
    document.all.item("xf_tym").style.visibility = 'visible';
    document.all.item("xf_tym").style.display = '';
    document.all.item("xg_tym").style.visibility = 'visible';
    document.all.item("xg_tym").style.display = '';
    document.all.item("xi_tym").style.visibility = 'visible';
    document.all.item("xi_tym").style.display = '';


       document.all.item("subka").style.visibility = 'visible';
       document.all.item("subka").style.display = '';
       if (document.all.item("subka2")) {
	  document.all.item("subka2").style.visibility = 'visible';
	  document.all.item("subka2").style.display = '';
       }
 }
 else if (katka == 4)     {
    document.all.item("xa_tym").style.visibility = 'visible';
    document.all.item("xa_tym").style.display = '';
    document.all.item("xb_tym").style.visibility = 'visible';
    document.all.item("xb_tym").style.display = '';
    document.all.item("xc_tym").style.visibility = 'visible';
    document.all.item("xc_tym").style.display = '';
    document.all.item("xf_tym").style.visibility = 'visible';
    document.all.item("xf_tym").style.display = '';
    document.all.item("xg_tym").style.visibility = 'visible';
    document.all.item("xg_tym").style.display = '';
    document.all.item("xi_tym").style.visibility = 'visible';
    document.all.item("xi_tym").style.display = '';
 }
 else if (katka == 5)     {
    document.all.item("xa_tym").style.visibility = 'visible';
    document.all.item("xa_tym").style.display = '';
    document.all.item("xb_tym").style.visibility = 'visible';
    document.all.item("xb_tym").style.display = '';
    document.all.item("xc_tym").style.visibility = 'visible';
    document.all.item("xc_tym").style.display = '';
    document.all.item("xf_tym").style.visibility = 'visible';
    document.all.item("xf_tym").style.display = '';
    document.all.item("xg_tym").style.visibility = 'visible';
    document.all.item("xg_tym").style.display = '';
    document.all.item("xi_tym").style.visibility = 'visible';
    document.all.item("xi_tym").style.display = '';
 }
 else if (katka == 6)     {
    document.all.item("xa_tym").style.visibility = 'visible';
    document.all.item("xa_tym").style.display = '';
    document.all.item("xb_tym").style.visibility = 'visible';
    document.all.item("xb_tym").style.display = '';
    document.all.item("xc_tym").style.visibility = 'visible';
    document.all.item("xc_tym").style.display = '';
    document.all.item("xf_tym").style.visibility = 'visible';
    document.all.item("xf_tym").style.display = '';
    document.all.item("xg_tym").style.visibility = 'visible';
    document.all.item("xg_tym").style.display = '';
 }
 else if (katka == 7)     {
    document.all.item("xa_tym").style.visibility = 'visible';
    document.all.item("xa_tym").style.display = '';
    document.all.item("xb_tym").style.visibility = 'visible';
    document.all.item("xb_tym").style.display = '';
    document.all.item("xc_tym").style.visibility = 'visible';
    document.all.item("xc_tym").style.display = '';
    document.all.item("xf_tym").style.visibility = 'visible';
    document.all.item("xf_tym").style.display = '';
    document.all.item("xg_tym").style.visibility = 'visible';
    document.all.item("xg_tym").style.display = '';
 }
 else if (katka == 8)     {
    document.all.item("xa_tym").style.visibility = 'visible';
    document.all.item("xa_tym").style.display = '';
    document.all.item("xb_tym").style.visibility = 'visible';
    document.all.item("xb_tym").style.display = '';
    document.all.item("xc_tym").style.visibility = 'visible';
    document.all.item("xc_tym").style.display = '';
    document.all.item("xf_tym").style.visibility = 'visible';
    document.all.item("xf_tym").style.display = '';
    document.all.item("xg_tym").style.visibility = 'visible';
    document.all.item("xg_tym").style.display = '';
    document.all.item("xi_tym").style.visibility = 'visible';
    document.all.item("xi_tym").style.display = '';
 }
*/


}

function numbersonly(myfield, e, dec) {
	var key;
	var keychar;

	if (window.event)
	   key = window.event.keyCode;
	else if (e)
	   key = e.which;
	else
	   return true;
	keychar = String.fromCharCode(key);

	if ((key==null) || (key==0) || (key==8) ||
	   (key==9) || (key==13) || (key==27) )
	   return true;
	else if ((("0123456789").indexOf(keychar) > -1))
	   return true;
	else if (dec && (keychar == "."))
	{
	   myfield.form.elements[dec].focus();
	   return false;
	}
	else
	   return false;
}

function isValidImageExt(imageName) {
	if(imageName.substring(imgPath.length-3, imageName.length).toLowerCase()!="jpg") {
		return false;
	}
		return true;
}

function isValidPPTExt(imageName) {
	if(imageName.substring(imgPath.length-3, imageName.length).toLowerCase()!="ppt") {
		return false;
	}
		return true;
}


function isValidImageExt2(imageName) {

	if(imageName.substring(imgPath.length-3, imageName.length).toLowerCase()!="jpg" &&
	   imageName.substring(imgPath.length-3, imageName.length).toLowerCase()!="gif" )	{
		return false;
	}
		return true;
}

function isValidImageExt2(imageName) {
	if(imageName.substring(imgPath.length-3, imageName.length).toLowerCase()!="jpg" &&
	   imageName.substring(imgPath.length-3, imageName.length).toLowerCase()!="gif" ) {

	   return false;
	}
	   return true;
}



function checkformBrief() {
	imgPath = document.addfrm.brief.value;
	if(imgPath != "" && !isValidBriefExt(imgPath)) {
		alert("Incorrect format");
		document.addfrm.brief.focus();
		return false;
	}
	document.addfrm.submit();
}


function isValidBriefExt(briefName) {
	if(briefName.substring(imgPath.length-3, briefName.length).toLowerCase()!="pdf" &&
	   briefName.substring(imgPath.length-3, briefName.length).toLowerCase()!="doc" &&
	   briefName.substring(imgPath.length-3, briefName.length).toLowerCase()!="rtf" &&
	   briefName.substring(imgPath.length-3, briefName.length).toLowerCase()!="txt" &&
	   briefName.substring(imgPath.length-3, briefName.length).toLowerCase()!="htm" &&
	   briefName.substring(imgPath.length-3, briefName.length).toLowerCase()!="gif" &&
	   briefName.substring(imgPath.length-4, briefName.length).toLowerCase()!="html") {
	   return false;
	}
	   return true;
}

function isFieldBlank(theField) {

	if(theField.value == "")
		return true;
	else
		return false;
}

function checkform() {
	agency=window.document.addfrm.agency.selectedIndex;
	if (agency=="") {
		alert("Agency must be selected!");
		window.document.addfrm.agency.focus();
		return false;
	}


	kat=window.document.addfrm.kategorie.selectedIndex;
	if (kat=="") {
		alert("A category into which the campaign will be included must be selected!");
		window.document.addfrm.kategorie.focus();
		return false;
	}

/*
	skat=window.document.addfrm.subkategorie.selectedIndex;
	if (kat==3) {
	  if (skat=="") {
		  alert("A sub-category into which the campaign will be included must be selected!");
		  window.document.addfrm.subkategorie.focus();
		  return false;
	  }
	}
*/

	if (isFieldBlank(window.document.addfrm.nazev)) {
		alert("The name of the campaign must be entered!");
		window.document.addfrm.nazev.focus();
		return false;
	}


	if (isFieldBlank(window.document.addfrm.klient)) {
		alert("The client of the campaign must be entered!");
		window.document.addfrm.klient.focus();
		return false;
	}

	if (isFieldBlank(window.document.addfrm.popis)) {
		alert("A description of the campaign must be entered!");
		window.document.addfrm.popis.focus();
		return false;
	}

	if (isFieldBlank(window.document.addfrm.nahled)) {
		alert("An overview of the campaign must be entered!");
		window.document.addfrm.nahled.focus();
		return
	}

	imgPath = document.addfrm.nahled.value;
	if(!isValidImageExt(imgPath)) {
		alert("The overview must be in JPG format!");
		document.addfrm.nahled.focus();
		return false;
	}

	document.addfrm.submit();
}


function checkform2() { 	  // tento check je stejny jako checkform, jen je vyopustena kontrola nahledoveho obrazku a kategorie

	agency=window.document.addfrm.agency.selectedIndex;
	if (agency=="") {
		alert("The agency must be selected!");
		window.document.addfrm.agency.focus();
		return false;
	}

/*
	kat=window.document.addfrm.kategorie.value;
	skat=window.document.addfrm.subkategorie.selectedIndex;
	window.alert ('aaaa' + skat);
	if (kat==3) {
	  if (skat=="") {
		  alert("Musí být vybrána subkategorie do které bude kampaň zařazena!");
		  window.document.addfrm.subkategorie.focus();
		  return false;
	  }
	}
*/
	agency=window.document.addfrm.agency.selectedIndex;
	if (agency=="") {
		alert("The agency must be selected!");
		window.document.addfrm.agency.focus();
		return false;
	}


	if (isFieldBlank(window.document.addfrm.nazev)) {
		alert("The name of the campaign must be entered!");
		window.document.addfrm.nazev.focus();
		return false;
	}
	if (isFieldBlank(window.document.addfrm.klient)) {
		alert("The client of the campaign must be entered!");
		window.document.addfrm.klient.focus();
		return false;
	}

	if (isFieldBlank(window.document.addfrm.popis)) {
		alert("A description of the campaign must be entered!");
		window.document.addfrm.popis.focus();
		return false;
	}
	document.addfrm.submit();
}



function checkformdata(kategorie) {
	 if (kategorie == 1) {
		 imgPath = document.addfrm.video1.value;
		 if(imgPath != "" && !isValidvideoExt(imgPath)) {
			 alert("The format is not correct!");
			 document.addfrm.video1.focus();
			 return false;
		 }

	 }
	 else if (kategorie == 2) {
		 imgPath = document.addfrm.radio1.value;
		 if(imgPath != "" && !isValidradioExt(imgPath)) {
			 alert("The format is not correct!");
			 document.addfrm.radio1.focus();
			 return false;
		 }
		 imgPath = document.addfrm.radio2.value;
		 if(imgPath != "" && !isValidradioExt(imgPath)) {
			 alert("The format is not correct!");
			 document.addfrm.radio2.focus();
			 return false;
		 }


	 }
	 else if (kategorie == 3) {
		 imgPath = document.addfrm.print1.value;
		 if(imgPath != "" && !isValidprintExt(imgPath)) {
			 alert("The format is not correct!");
			 document.addfrm.print1.focus();
			 return false;
		 }
		 imgPath = document.addfrm.print2.value;
		 if(imgPath != "" && !isValidprintExt(imgPath)) {
			 alert("The format is not correct!");
			 document.addfrm.print2.focus();
			 return false;
		 }
		 imgPath = document.addfrm.print3.value;
		 if(imgPath != "" && !isValidprintExt(imgPath)) {
			 alert("The format is not correct!");
			 document.addfrm.print3.focus();
			 return false;
		 }

	 }
	 else if (kategorie == 4) {
		 imgPath = document.addfrm.mail1.value;
		 if(imgPath != "" && !isValidprintExt(imgPath)) {
			 alert("The format is not correct!");
			 document.addfrm.mail1.focus();
			 return false;
		 }
		 imgPath = document.addfrm.mail2.value;
		 if(imgPath != "" && !isValidprintExt(imgPath)) {
			 alert("The format is not correct!");
			 document.addfrm.mail2.focus();
			 return false;
		 }
		 imgPath = document.addfrm.mail3.value;
		 if(imgPath != "" && !isValidprintExt(imgPath)) {
			 alert("The format is not correct!");
			 document.addfrm.mail3.focus();
			 return false;
		 }
		 imgPath = document.addfrm.mail4.value;
		 if(imgPath != "" && !isValidmail2Ext(imgPath)) {
			 alert("The format is not correct!");
			 document.addfrm.mail4.focus();
			 return false;
		 }
	 }
	 else if (kategorie == 5) {
		 imgPath = document.addfrm.banner1.value;
		 if(imgPath != "" && !isValidbannerExt(imgPath)) {
			 alert("The format is not correct!");
			 document.addfrm.banner1.focus();
			 return false;
		 }
		 imgPath = document.addfrm.banner2.value;
		 if(imgPath != "" && !isValidbannerExt(imgPath)) {
			 alert("The format is not correct!");
			 document.addfrm.banner2.focus();
			 return false;
		 }
		 imgPath = document.addfrm.banner3.value;
		 if(imgPath != "" && !isValidbannerExt(imgPath)) {
			 alert("The format is not correct!");
			 document.addfrm.banner3.focus();
			 return false;
		 }

	 }
	 else if (kategorie == 6) {
		 imgPath = document.addfrm.face1.value;
		 if(imgPath != "" && !isValidvideoExt(imgPath)) {
			 alert("The format is not correct!");
			 document.addfrm.face1.focus();
			 return false;
		 }
		 imgPath = document.addfrm.face2.value;
		 if(imgPath != "" && !isValidImageExt(imgPath)) {
			 alert("The format is not correct!");
			 document.addfrm.face2.focus();
			 return false;
		 }
		 imgPath = document.addfrm.face3.value;
		 if(imgPath != "" && !isValidImageExt(imgPath)) {
			 alert("The format is not correct!");
			 document.addfrm.face3.focus();
			 return false;
		 }
		 imgPath = document.addfrm.face4.value;
		 if(imgPath != "" && !isValidImageExt(imgPath)) {
			 alert("The format is not correct!");
			 document.addfrm.face4.focus();
			 return false;
		 }
		 imgPath = document.addfrm.face5.value;
		 if(imgPath != "" && !isValidImageExt(imgPath)) {
			 alert("The format is not correct!");
			 document.addfrm.face5.focus();
			 return false;
		 }
		 imgPath = document.addfrm.face6.value;
		 if(imgPath != "" && !isValidImageExt(imgPath)) {
			 alert("The format is not correct!");
			 document.addfrm.face6.focus();
			 return false;
		 }
		 imgPath = document.addfrm.face7.value;
		 if(imgPath != "" && !isValidPPTExt(imgPath)) {
			 alert("The format is not correct!");
			 document.addfrm.face7.focus();
			 return false;
		 }

	 }
	 else if (kategorie == 7) {
		 imgPath = document.addfrm.sales1.value;
		 if(imgPath != "" && !isValidvideoExt(imgPath)) {
			 alert("The format is not correct!");
			 document.addfrm.sales1.focus();
			 return false;
		 }
		 imgPath = document.addfrm.sales2.value;
		 if(imgPath != "" && !isValidImageExt(imgPath)) {
			 alert("The format is not correct!");
			 document.addfrm.sales2.focus();
			 return false;
		 }
		 imgPath = document.addfrm.sales3.value;
		 if(imgPath != "" && !isValidImageExt(imgPath)) {
			 alert("The format is not correct!");
			 document.addfrm.sales3.focus();
			 return false;
		 }
		 imgPath = document.addfrm.sales4.value;
		 if(imgPath != "" && !isValidImageExt(imgPath)) {
			 alert("The format is not correct!");
			 document.addfrm.sales4.focus();
			 return false;
		 }
		 imgPath = document.addfrm.sales5.value;
		 if(imgPath != "" && !isValidImageExt(imgPath)) {
			 alert("The format is not correct!");
			 document.addfrm.sales5.focus();
			 return false;
		 }
		 imgPath = document.addfrm.sales6.value;
		 if(imgPath != "" && !isValidPPTExt(imgPath)) {
			 alert("The format is not correct!");
			 document.addfrm.sales6.focus();
			 return false;
		 }

		 imgPath = document.addfrm.sales7.value;
		 if(imgPath != "" && !isValidradioExt(imgPath)) {
			 alert("The format is not correct!");
			 document.addfrm.sales7.focus();
			 return false;
		 }

	 }
	 else if (kategorie == 8) {
		 imgPath = document.addfrm.design1.value;
		 if(imgPath != "" && !isValidprintExt(imgPath)) {
			 alert("The format is not correct!");
			 document.addfrm.design1.focus();
			 return false;
		 }
		 imgPath = document.addfrm.design2.value;
		 if(imgPath != "" && !isValidprintExt(imgPath)) {
			 alert("The format is not correct!");
			 document.addfrm.design2.focus();
			 return false;
		 }
		 imgPath = document.addfrm.design3.value;
		 if(imgPath != "" && !isValidprintExt(imgPath)) {
			 alert("The format is not correct!");
			 document.addfrm.design3.focus();
			 return false;
		 }
		 imgPath = document.addfrm.design4.value;
		 if(imgPath != "" && !isValiddesignExt(imgPath)) {
			 alert("The format is not correct!");
			 document.addfrm.design4.focus();
			 return false;
		 }
	 }


	document.addfrm.submit();
}


function isValidradioExt(briefName) {
	if(briefName.substring(imgPath.length-3, briefName.length).toLowerCase()!="mp3")  {
	   return false;
	}
	   return true;
}

function isValidprintExt(briefName) {
	if(briefName.substring(imgPath.length-3, briefName.length).toLowerCase()!="jpg")  {
	   return false;
	}
	   return true;
}


function isValidvideoExt(briefName) {
	if(briefName.substring(imgPath.length-3, briefName.length).toLowerCase()!="avi" &&
	   briefName.substring(imgPath.length-4, briefName.length).toLowerCase()!="mpeg" &&

	   briefName.substring(imgPath.length-3, briefName.length).toLowerCase()!="mpg") {
	   return false;
	}
	   return true;
}


function isValidmailExt(briefName) {
	if(briefName.substring(imgPath.length-3, briefName.length).toLowerCase()!="jpg")		{
	   return false;
	}
	   return true;
}

/* ZALOHA PUVODNI VERZE - 21.9.04 ....
function isValidmail2Ext(briefName) {
	if(briefName.substring(imgPath.length-4, briefName.length).toLowerCase()!="html" &&
	   briefName.substring(imgPath.length-3, briefName.length).toLowerCase()!="htm" &&

	   briefName.substring(imgPath.length-3, briefName.length).toLowerCase()!="pdf") {


	   return false;
	}
	   return true;
}
*/

function isValidmail2Ext(briefName) {
	if(briefName.substring(imgPath.length-4, briefName.length).toLowerCase()!="html" &&
	   briefName.substring(imgPath.length-3, briefName.length).toLowerCase()!="htm" &&
	   briefName.substring(imgPath.length-3, briefName.length).toLowerCase()!="jpg" &&
	   briefName.substring(imgPath.length-3, briefName.length).toLowerCase()!="pdf") {


	   return false;
	}
	   return true;
}


function isValidimageExt(briefName) {
	if(briefName.substring(imgPath.length-3, briefName.length).toLowerCase()!="jpg" &&
	   briefName.substring(imgPath.length-3, briefName.length).toLowerCase()!="gif") {


	   return false;
	}
	   return true;
}

function isValiddesignExt(briefName) {
	if(briefName.substring(imgPath.length-3, briefName.length).toLowerCase()!="jpg" &&
	   briefName.substring(imgPath.length-3, briefName.length).toLowerCase()!="pdf") {


	   return false;
	}
	   return true;
}


/*
function isValidmail2Ext(briefName) {
	if(briefName.substring(imgPath.length-4, briefName.length).toLowerCase()!="html" &&
	   briefName.substring(imgPath.length-3, briefName.length).toLowerCase()!="htm" &&
	
	   briefName.substring(imgPath.length-3, briefName.length).toLowerCase()!="pdf") {	  
	
		
	   return false;
	}
	   return true;
}
*/


function isValidbannerExt(briefName) {
	if(briefName.substring(imgPath.length-3, briefName.length).toLowerCase()!="swf" &&
           briefName.substring(imgPath.length-3, briefName.length).toLowerCase()!="jpg" 

        )
		{
	   return false;
	}
	   return true;
}




function TrackCount(fieldObj,countFieldName,maxChars)
{
  var countField = eval("fieldObj.form."+countFieldName);
  var diff = maxChars - fieldObj.value.length;

  // Need to check & enforce limit here also in case user pastes data
  if (diff < 0)
  {
	fieldObj.value = fieldObj.value.substring(0,maxChars);
	diff = maxChars - fieldObj.value.length;
  }
//	countField.value = diff;
}

function LimitText(fieldObj,maxChars)
{
  var result = true;
  if (fieldObj.value.length >= maxChars)
	result = false;
  
  if (window.event)
	window.event.returnValue = result;
  return result;
}

function ShowAgency(id,pocet)
{
  var i;  
  document.getElementById("other").style.visibility = "hidden";
  document.getElementById("other").style.display = "none";
  
  for (i=1;i<=pocet;i++)
  {
      document.getElementById("agency_"+i).style.visibility = "hidden";
      document.getElementById("agency_"+i).style.display = "none";
  }
  document.getElementById("agency_"+id).style.visibility = "visible";
  document.getElementById("agency_"+id).style.display = "block";
}

function ShowAgencyEdit(id,pocet)
{
  var i;  
  for (i=1;i<=pocet;i++)
  {
      document.getElementById("agency_"+i).style.visibility = "hidden";
      document.getElementById("agency_"+i).style.display = "none";
  }
  document.getElementById("agency_"+id).style.visibility = "visible";
  document.getElementById("agency_"+id).style.display = "block";
}

function CheckReg() 
{
  var f = document.forms["registrace"];
  var mail = "^[_a-zA-Z0-9\.\-]+@[_a-zA-Z0-9\.\-]+[\.]{1}[a-zA-Z]{2,4}$";
  
  if (f.rjmeno.value == "")
	{
    alert("Fill your first name.");
    f.rjmeno.focus();
    return false;
  }
  
  if (f.rprijmeni.value == "")
	{
    alert("Fill your surname.");
    f.rprijmeni.focus();
    return false;
  }
  
  if (f.rmail.value == "")
	{
    alert("Fill your email.");
    f.rmail.focus();
    return false;
  }

 if (!f.rmail.value.match(mail)) {
		alert ("Not valid email.");
		f.rmail.focus();
		return false;
	}
	
	if (f.pass1.value == "" || f.pass1.value != f.pass2.value)
	{
    alert("Both passwords must be same and filled.")
    f.pass1.focus();
    return false;
  }

	if (f.rstat.value == 'none')
	{
  	alert ("Choose your country.");
  	f.rstat.focus();
		return false;
  }
	
	if (document.getElementById("ragentura").value == 0 && f.other.value == "")
	{
  	alert ("Choose your agency or fill your agency.");
  	f.other.focus();
		return false;
  }
	
	return true;
}

function AddAgentura(id){
    document.getElementById("ragentura").value = id;
    
    document.getElementById("other").style.visibility = "hidden";
    document.getElementById("other").style.display = "none";
    if (id == 'x' ) 
    {
      document.getElementById("ragentura").value = 0;
      document.getElementById("other").style.visibility = "visible";
      document.getElementById("other").style.display = "inline";  
    }
} 

function ViewBlok(id)
{
  if (document.getElementById(id).style.visibility == "visible")
  {
    document.getElementById(id).style.visibility = "hidden"  
    document.getElementById(id).style.display = "none";
  }
  else
  {
    document.getElementById(id).style.visibility = "visible"  
    document.getElementById(id).style.display = "block";
  }
  return false;
}


function showFormVzkaz()
{
  if (document.getElementById('vzkaz').style.visibility == "visible")
  {
    document.getElementById('vzkaz').style.visibility = "hidden"  
    document.getElementById('vzkaz').style.display = "none";
  }
  else
  {
    document.getElementById('vzkaz').style.visibility = "visible"  
    document.getElementById('vzkaz').style.display = "block";
  }
  return false;
}

function validateVzkaz(f){

  var mail = "^[_a-zA-Z0-9\.\-]+@[_a-zA-Z0-9\.\-]+[\.]{1}[a-zA-Z]{2,4}$";
  
  
  if (f.email.value == "")
	{
    alert("Fill your email.");
    f.email.focus();
    return false;
  }

 if (!f.email.value.match(mail)) {
		alert ("Not valid email.");
		f.email.focus();
		return false;
	}

 if (f.subject.value == "")
	{
    alert("Fill message subject.");
    f.subject.focus();
    return false;
  }
  
  if (f.text.value == "")
	{
    alert("Write text of message.");
    f.text.focus();
    return false;
  }


return true; }

  var okno;

 function wopen(href,width,height,other){
       
       var sirkaOkna;
       var vyskaOkna;
       var nastaveni;
         sirkaOkna=screen.availWidth;    
         vyskaOkna=screen.availHeight;     
        
                             
         sirkaOkna -= width;
         sirkaOkna -= 25; //scrollbar
         sirkaOkna /= 2;
         
         vyskaOkna -= height;
         vyskaOkna /= 2;

         vyskaOkna = Math.round(vyskaOkna);
         sirkaOkna = Math.round(sirkaOkna);           
                         
         if ( other != '' )
           nastaveni = 'width='+width+',height='+height+',menubar=no,top='+vyskaOkna+',left='+sirkaOkna+','+other+'';
         else        
           nastaveni = 'width='+width+',height='+height+',menubar=no,top='+vyskaOkna+',left='+sirkaOkna+'';

        okno = window.open(href,'',''+nastaveni+'');
         
        if(okno) okno.focus();
        
  }
                  

//-->

