function ShowBox_add(id, action, countryid, sumitem, showexists) {
	if(!showexists) {showexists=0}
	for(i=1; i < sumitem; i++) {
		document.getElementById('addbox0_'+i).innerHTML="";
		document.getElementById('addbox0_'+i).style.display="none";
		document.getElementById('addbox1_'+i).innerHTML="";
		document.getElementById('addbox1_'+i).style.display="none";

		document.getElementById('removebox0_'+i).innerHTML="";
		document.getElementById('removebox0_'+i).style.display="none";
		document.getElementById('removebox1_'+i).innerHTML="";
		document.getElementById('removebox1_'+i).style.display="none";
	}
	div = document.getElementById('addbox'+action+'_'+id)
	
	if(action==1) {
		div.innerHTML = '<iframe src="/action.asp?nCountryID='+countryid+'&nPositionBox='+id+'&bShowExists='+showexists+'" frameborder="0" width="300" height="450" scrolling="Yes" />'
	} else {
		div.innerHTML = '<iframe src="/destination.asp?nCountryID='+countryid+'&nPositionBox='+id+'&bShowExists='+showexists+'" frameborder="0" width="300" height="450" scrolling="Yes" />'
	}
	div.style.display='block';	
}
function ShowBox_remove(id, action, countryid, sumitem) {
	for(i=1; i < sumitem; i++) {
		document.getElementById('addbox0_'+i).innerHTML="";
		document.getElementById('addbox0_'+i).style.display="none";
		document.getElementById('addbox1_'+i).innerHTML="";
		document.getElementById('addbox1_'+i).style.display="none";

		document.getElementById('removebox0_'+i).innerHTML="";
		document.getElementById('removebox0_'+i).style.display="none";
		document.getElementById('removebox1_'+i).innerHTML="";
		document.getElementById('removebox1_'+i).style.display="none";
	}
	div = document.getElementById('removebox'+action+'_'+id)

	if(action==1) {
		div.innerHTML = '<iframe src="/action.asp?nCountryID='+countryid+'&sAction=removebox&nPositionBox='+id+'" frameborder="0" width="300" height="450" scrolling="Yes" />'
	} else {
		div.innerHTML = '<iframe src="/destination.asp?nCountryID='+countryid+'&sAction=removebox&nPositionBox='+id+'" frameborder="0" width="300" height="450" scrolling="Yes" />'
	}
	div.style.display='block';	
}
function HideBox_add(id, action) {
	window.parent.document.getElementById('addbox'+action+'_'+id).style.display="none";
}

function ChooseContinent(continentid, sumitem) {

	for(i=2; i <= sumitem; i++) {
		document.getElementById('continent'+i).style.display="none";
	}
	document.getElementById('continent'+continentid).style.display = "block";

	for(i=2; i <= sumitem; i++) {
		if(i==sumitem) {document.getElementById('continent-href'+i).className="last";}
		else {document.getElementById('continent-href'+i).className="";}
	}
	if(i==sumitem) {document.getElementById('continent-href'+continentid).className = "act last";;}
	else {document.getElementById('continent-href'+continentid).className = "act";}
	
}

function AddComment() {
	document.getElementById('voteform').style.display='block'
}

function FastFact(type) {
	var tab2 = "<div id=\"tabmenu\"><div class=\"tabcontrol_act\"><div class=\"tabcontrol_act_left\"><div class=\"tabcontrol_act_right\"><div class=\"in_tabcontrol\"><span id=\"fastfact\">Why to visit</span></div></div></div></div><div class=\"tabcontrol\"><div class=\"tabcontrol_right\"><div class=\"in_tabcontrol\"><span id=\"fastfact\"><a href=\"javascript:FastFact(1)\">Fast Facts</a></span></div></div></div></div>"
  var tab1 = "<div id=\"tabmenu\"><div class=\"tabcontrol\"><div class=\"tabcontrol_right\"><div class=\"in_tabcontrol\"><span id=\"fastfact\"><a href=\"javascript:FastFact(0)\">Why to visit</a></span></div></div></div><div class=\"tabcontrol_act\"><div class=\"tabcontrol_act_left\"><div class=\"tabcontrol_act_right\"><div class=\"in_tabcontrol\"><span id=\"fastfact\">Fast Facts</span></div></div></div></div></div>"
		
  if(type==1) {
	  document.getElementById('tabmenu').innerHTML = tab1
		//document.getElementById('fastfact01').innerHTML = "Fast facts"
		document.getElementById('fastfact02').style.display = "none"
		document.getElementById('fastfact03').style.display = "block"
	} else {
		document.getElementById('tabmenu').innerHTML = tab2
		//document.getElementById('fastfact01').innerHTML = "Why to visit"
		document.getElementById('fastfact02').style.display = "block"
		document.getElementById('fastfact03').style.display = "none"
	}
}

function SortBy(type, action) {
	Form = document.getElementById('sortby'+action)
	Form.sSortBy.value=type
	Form.submit()
}

var countvotedestination = 0
var countvoteaction = 0
function ShowHideVote(position, action, sumitem){
	if(sumitem > 6) sumitem = 6
	if(action==1) {countvoteaction=sumitem}
	else {countvotedestination=sumitem}
	for(i=1; i < sumitem; i++) {
		if(i!=position) {
			document.getElementById('vote'+action+'-'+i).style.display='none';
		}
	}
	
	if(action==1 && countvotedestination > 0) {
		for(i=1; i < countvotedestination; i++) {
			document.getElementById('vote0-'+i).style.display='none';
		}
	} else if (action==0 && countvoteaction > 0) {
		for(i=1; i < countvoteaction; i++) {
			document.getElementById('vote1-'+i).style.display='none';
		}
	}
	
	var object = document.getElementById('vote'+action+'-'+position)
	if (object.style.display=='none' || object.style.display=='') {
		object.style.display='block';
	} else {
		object.style.display='none';
	}
}

function photosort(SortBy, URL) {
	if(URL.indexOf('/sortby/')) {
		URL = URL.substring(0, URL.indexOf('/sortby/') + 1)
	}
	window.open(URL + 'sortby/' + SortBy + '/#photos', '_self')
}

function FillFileName(form) {
	ShowAnimationUpload();
	if(form.sFileName.value!='') {form.sHelpFileName.value = form.sFileName.value}
	if(form.sFileName2.value!='') {form.sHelpFileName2.value = form.sFileName2.value}
	if(form.sFileName3.value!='') {form.sHelpFileName3.value = form.sFileName3.value}
	if(form.sFileName4.value!='') {form.sHelpFileName4.value = form.sFileName4.value}
	if(form.sFileName5.value!='') {form.sHelpFileName5.value = form.sFileName5.value}

	return true
}

function ShowNextPhoto() {
	Photo2_1 = document.getElementById('photo2_1')
//	Photo2_2 = document.getElementById('photo2_2')
	
	Photo3_1 = document.getElementById('photo3_1')
//	Photo3_2 = document.getElementById('photo3_2')
	
	Photo4_1 = document.getElementById('photo4_1')
//	Photo4_2 = document.getElementById('photo4_2')
	
	Photo5_1 = document.getElementById('photo5_1')
//	Photo5_2 = document.getElementById('photo5_2')
	
	CountUploadPhoto = document.getElementById('nCountUploadPhoto')

	if(Photo2_1.style.display=='none' || Photo2_1.style.display=='') {
		Photo2_1.style.display='block';
		CountUploadPhoto.value=2;
	} else if(Photo3_1.style.display=='none' || Photo3_1.style.display=='') {
		Photo3_1.style.display='block';
		CountUploadPhoto.value=3;
	} else if(Photo4_1.style.display=='none' || Photo4_1.style.display=='') {
		Photo4_1.style.display='block';
		CountUploadPhoto.value=4;
	} else if(Photo5_1.style.display=='none' || Photo5_1.style.display=='') {
		Photo5_1.style.display='block';
		CountUploadPhoto.value=5;
		document.getElementById('nextphoto').innerText='';
	}
	
/*
	if(Photo2_1.style.display=='none' || Photo2_1.style.display=='') {
		Photo2_1.style.display='block';
		Photo2_2.style.display='block';
		CountUploadPhoto.value=2;
	} else if(Photo3_1.style.display=='none' || Photo3_1.style.display=='') {
		Photo3_1.style.display='block';
		Photo3_2.style.display='block';
		CountUploadPhoto.value=3;
	} else if(Photo4_1.style.display=='none' || Photo4_1.style.display=='') {
		Photo4_1.style.display='block';
		Photo4_2.style.display='block';
		CountUploadPhoto.value=4;
	} else if(Photo5_1.style.display=='none' || Photo5_1.style.display=='') {
		Photo5_1.style.display='block';
		Photo5_2.style.display='block';
		CountUploadPhoto.value=5;
		document.getElementById('nextphoto').innerText='';
	}
*/
}

function AddPhoto_ChooseType(form) {
	var Type1 = document.getElementById('ChooseType1').checked
	var Type2 = document.getElementById('ChooseType2').checked
	var Type3 = document.getElementById('ChooseType3').checked
	if(Type1==true) {
//		document.getElementById('traction').style.display='none';
//		document.getElementById('trdestination').style.display='block';

		form.nActionID.disabled = true
		form.nDestinationID.disabled = false
	} else if(Type2==true) {
//		document.getElementById('traction').style.display='block';
//		document.getElementById('trdestination').style.display='none';
		
		form.nActionID.disabled = false
		form.nDestinationID.disabled = true
	} else if(Type3==true) {
//		document.getElementById('traction').style.display='none';
//		document.getElementById('trdestination').style.display='none';
		form.nActionID.options.selectedIndex = 0
		form.nDestinationID.options.selectedIndex = 0
		form.nActionID.disabled = true
		form.nDestinationID.disabled = true
		document.getElementById('savephotos').nActionID.value = 0
		document.getElementById('savephotos').nDestinationID.value = 0
	}
}

function AllItemVisit(ID, action) {
	ItemmVisit = document.getElementById('visitcountry'+ID)
	Ahref = document.getElementById('ahref'+ID)
	if(ItemmVisit.style.display=='none' || ItemmVisit.style.display=='' && action!='hide') {
		ItemmVisit.style.display='block';
		Ahref.innerText = 'Hide visits';
	} else {
		ItemmVisit.style.display='none';
		Ahref.innerText = 'Show visits';
	}
}

function profilefilter(form) {

	var sURL
	var sHomeCountry = form.sHomeCountryID.value
	var sVisitedCountry = form.sVisitedCountryID.value
	var sNextTripCountry = form.sNextTripCountryID.value
	var nPageSize = form.nPageSize.value

	var sSortBy = form.sSortBy.value
	var nPage = form.nPage.value

	sURL = "/member/"

	if(sHomeCountry.length > 0){sURL += 'homecountry/'+sHomeCountry+'/';}
	if(sVisitedCountry.length > 0){sURL += 'visitedcountry/'+sVisitedCountry+'/'}
	if(sNextTripCountry.length > 0){sURL += 'nexttripcountry/'+sNextTripCountry+'/'}
	
	if(sSortBy!==''){sURL += 'sortby/'+sSortBy+'/'}
	if(nPageSize > 8){sURL += 'pagesize/'+nPageSize+'/'}
//	if(nPage > 0){sURL += 'page/'+nPage+'/'}
	
	window.open(sURL, '_self')
	return false
}

function photofilter_profile(form) {
	var sURL
	var sCountry = form.sCountryID.value
	var nYearVisit = form.nYearVisit.value
	var sMember = form.sMember.value
	var sPreviousCountry = form.sPreviousCountry.value

	var sSortBy = form.sSortBy.value
	var nPageSize = form.nPageSize.value
	var nPage = form.nPage.value

	sURL = "/member/" + sMember + "/photos/"
	
	if(sCountry.length > 0){sURL += 'country/'+sCountry+'/';}
	if(nYearVisit > 0 && sPreviousCountry == sCountry){sURL += 'year/'+nYearVisit+'/'}
	if(sSortBy!==''){sURL += 'sortby/'+sSortBy+'/'}
	if(nPageSize > 8){sURL += 'pagesize/'+nPageSize+'/'}
	
	window.open(sURL, '_self')
	return false
}

function photofilter(form) {
	var sURL
	var sCountry = form.sCountryID.value
	var sDestination = form.sDestinationID.value
	var sAction = form.sActionID.value
	var sTraveller = form.sProfileID.value
	var bFaces = form.bFaces.checked

	var sSortBy = form.sSortBy.value
	var nPageSize = form.nPageSize.value
	var nPage = form.nPage.value

	sURL = "/photos/"
	
	if(sCountry.length > 0){sURL += 'country/'+sCountry+'/';}
	if(sDestination.length > 0){sURL += 'place/'+sDestination+'/'}
	if(sAction.length > 0){sURL += 'experience/'+sAction+'/'}
	if(sTraveller.length > 0){sURL += 'member/'+sTraveller+'/'}
	if(bFaces) {sURL += 'faces/'}
	if(sSortBy!==''){sURL += 'sortby/'+sSortBy+'/'}
	if(nPageSize > 8){sURL += 'pagesize/'+nPageSize+'/'}
	
	window.open(sURL, '_self')
	return false
}

function photofilter_country(form) {
	var sURL
	var sCountry = form.sCountryID.value

	var sSortBy = form.sSortBy.value
	var nPage = form.nPage.value

	sURL = "/photos/"
	
	if(sCountry.length > 0){sURL += 'country/'+sCountry+'/';}
	if(sSortBy!==''){sURL += 'sortby/'+sSortBy+'/'}
	if(nPage > 0){sURL += 'page/'+nPage+'/'}
	
	window.open(sURL, '_self')
	return false
}

//zmena obrazku pri hlasovani
var VoteImg
var VoteID
function changeimg(Img, action, type, all) {
	
	if(type==1) {Img = document.getElementById(Img)}
	if(all==1) {all = '-all'}
	else {all=''}

	var form = document.getElementById('form'+all+Img.id.substring(5, Img.id.lastIndexOf('-')))
	
	if(VoteImg==null || VoteImg!==Img) {
		if(action=='hover') {
			Img.src='/data/xsl/img/vote-hover.gif'
		} else if(action=='normal') {
			Img.src='/data/xsl/img/vote.gif'
		} else if(action=='act' || action=='act1') {
			if(VoteImg) {VoteImg.src='/data/xsl/img/vote.gif';}
			Img.src='/data/xsl/img/vote-act.gif';
			
			//Img.parentNode.parentNode.nPoints.value=Img.id.substring(Img.id.lastIndexOf('-') + 1, Img.id.length);
			form.nPoints.value=Img.id.substring(Img.id.lastIndexOf('-') + 1, Img.id.length);
			VoteID = Img.id.substring(7, Img.id.lastIndexOf('-'))
			VoteImg = Img
			
			if(action=='act') form.submit()
		}
	}
}

//kontrola jestli vybral nejaky bod
function checkvote(form, action) {
	var nID
	if(action==1) {nID = form.nActionID.value}
	else {nID = form.nDestinationID.value}
	if(VoteImg && form.nPoints.value!=='' && VoteID==nID) {
		return true
	} else {
		alert('You must select points!')
		return false
	}
}

function allexperiences() {
	var box = document.getElementById('allactiontovote')
	if(document.getElementById('alldestinationtovote')) {
		document.getElementById('alldestinationtovote').style.display="none"
	}
	
	if(box.style.display=="none" || box.style.display=="") {
		box.style.display="block";
	} else {
		box.style.display="none";
	}
}

function allplaces() {
	var box = document.getElementById('alldestinationtovote')
	if(document.getElementById('allactiontovote')) {
		document.getElementById('allactiontovote').style.display="none"
	}
	if(box.style.display=="none" || box.style.display=="") {
		box.style.display="block";
	} else {
		box.style.display="none";
	}
}

// zapise hodnoty z basic registrace do advanced
function AdvancedRegistration() {
var Basic = document.getElementById('basic_form')
var Advanced = document.getElementById('advanced_form')

Advanced.sLogin.value = Basic.sLogin.value
if(Basic.sOldPassword) {
	Advanced.sOldPassword.value = Basic.sOldPassword.value
}
Advanced.sPassword.value = Basic.sPassword.value
Advanced.sConfirmPassword.value = Basic.sConfirmPassword.value
Advanced.sEmail.value = Basic.sEmail.value
if(Basic.bNewsLetter.checked) Advanced.bNewsLetter.value = "True"
else Advanced.bNewsLetter.value = "False"

return true
}

// zobrazeni popisu u destinace na detailu zeme
function ShowDesc(div) {
	document.getElementById(div).style.display="block";
}
function HideDesc(div) {
	document.getElementById(div).style.display="none";
}

function ShowInputPhoto() {
	document.getElementById('photo1').style.display='none'
	document.getElementById('photo2').style.display='block'
}

function HomeCountry(Country) {
//	if(document.getElementById('sText01').value=='' || (document.getElementById('sText02').value=='' || document.getElementById('sText02').value=='1970')) {
		document.getElementById('sText01').options.selectedIndex = Country.options.selectedIndex
//	}
}

function HomeCountryYear(Year) {
	document.getElementById('sText02').options.selectedIndex = Year.options.selectedIndex
}

function CheckYearFormerCountry(nInput, nFromYear, nToYear) {
	if(!nFromYear > 0) {
		var nSelectedIndex = document.getElementById('Text0'+nInput).options.selectedIndex
		var YearExistsFrom = document.getElementById('Text0'+nInput+'_From')
		if(document.getElementById('Text0'+nInput+'_To')) {
			var YearExistsTo = document.getElementById('Text0'+nInput+'_To')
		} else {
			var YearExistsTo = YearExistsFrom
		}
	
	/*		
			alert(aFormerCountry_YearExistsFrom[nSelectedIndex]);
			alert(aFormerCountry_YearExistsTo[nSelectedIndex]);
			alert(YearExistsFrom.value);
	*/
	
		//celkovy pocet zemi musim pricist o dva kvuli javascriptu, ktery pocita od nuly
		//nSelectedIndex = nSelectedIndex - nCountNotFormer - 2
	
		var nFrom = Math.abs(aFormerCountry_YearExistsFrom[nSelectedIndex])
		var nTo = Math.abs(aFormerCountry_YearExistsTo[nSelectedIndex])
	} else {
		var YearExistsFrom = document.getElementById('Text0'+nInput+'_From')
		var YearExistsTo = YearExistsFrom
		
		var nFrom = nFromYear
		if(!nToYear > 0) var nTo = 0
		else nTo = nToYear
	}
	var nSelectedFrom = Math.abs(YearExistsFrom.value)
	var nSelectedTo = Math.abs(YearExistsTo.value)

	if (nSelectedFrom > nSelectedTo) {
		if (Math.abs(YearExistsFrom.options[0].value) > (nSelectedTo - 1)) {
			YearExistsFrom.options.selectedIndex = 0
		} else {
			YearExistsFrom.value = nSelectedTo - 1
		}
	}	
	if(nFrom > 0 && nTo > 0) {
		if (!(nSelectedFrom > nFrom && nSelectedFrom < nTo)) {
			if (Math.abs(YearExistsFrom.options[0].value) > nFrom) {
				YearExistsFrom.options.selectedIndex = 0
			} else {
				YearExistsFrom.value = nFrom
			}
		}

		if (!(nSelectedTo > nFrom && nSelectedTo < nTo)) {
			if (Math.abs(YearExistsTo.options[0].value) > nTo) {
				YearExistsTo.options.selectedIndex = 0
			} else {
				YearExistsTo.value = nTo
			}
		}
	} else if(nFrom > 0 && nTo == 0) {
		if (nSelectedFrom < nFrom) {
			if (Math.abs(YearExistsFrom.options[0].value) > nFrom) {
				YearExistsFrom.options.selectedIndex = 0
			} else {
				YearExistsFrom.value = nFrom
			}
		}
	}
	
	if (nSelectedIndex == 0) {
		YearExistsFrom.options.selectedIndex = 0
		if(YearExistsTo!=null) {YearExistsTo.options.selectedIndex = 0}
	}


/*
//	if (nSelectedIndex > nCountNotFormer) {
	//celkovy pocet zemi musim pricist o dva kvuli javascriptu, ktery pocita od nuly
		nSelectedIndex = nSelectedIndex - nCountNotFormer - 2
		
		var nSelectedFrom = Math.abs(YearExistsFrom.value)
		var nSelectedTo = Math.abs(YearExistsTo.value)
		
		var nFrom = Math.abs(aFormerCountry_YearExistsFrom[nSelectedIndex])
		var nTo = Math.abs(aFormerCountry_YearExistsTo[nSelectedIndex])

		if (nSelectedFrom > nSelectedTo) {
			if (Math.abs(YearExistsFrom.options[0].value) > (nSelectedTo - 1)) {
				YearExistsFrom.options.selectedIndex = 0
			} else {
				YearExistsFrom.value = nSelectedTo - 1
			}
		}
		
		if (!(nSelectedFrom > nFrom && nSelectedFrom < nTo)) {
			if (Math.abs(YearExistsFrom.options[0].value) > nFrom) {
				YearExistsFrom.options.selectedIndex = 0
			} else {
				YearExistsFrom.value = nFrom
			}
		}
		
		if (!(nSelectedTo > nFrom && nSelectedTo < nTo)) {
			if (Math.abs(YearExistsTo.options[0].value) > nTo) {
				YearExistsTo.options.selectedIndex = 0
			} else {
				YearExistsTo.value = nTo
			}
//		}
//	} else if (nSelectedIndex == 0) {
	if (nSelectedIndex == 0) {
		YearExistsFrom.options.selectedIndex = 0
		YearExistsTo.options.selectedIndex = 0
	}
*/
}

function EmailWrite(EmailName, Domain, Name, ClassName) {
	if(ClassName=='') {
		document.write('<a href="mailto:'+EmailName+'@'+Domain+'">'+Name+'</a>')
	}
	else {
		document.write('<a href="mailto:'+EmailName+'@'+Domain+'" class="'+ClassName+'">'+Name+'</a>')
	}
}

function Remove(type, nID, Name, nCountryID, nDestinationID, nActionID) {
	if (nCountryID=="") nCountryID = 0
	if (nDestinationID=="") nDestinationID = 0
	if (nActionID=="") nActionID = 0
	var Message = "Do you really remove "+Name+"?";
	if(type == 'country') {
		if(confirm(Message)) window.open('/visitcountry.asp?sAction=remove&nCountryID='+nID, '_self')
	} else if(type == 'visitcountry') {
		if(confirm(Message)) window.open('/visitcountry.asp?sAction=removevisit&nVisitID='+nID+'&nCountryID='+nCountryID, '_self')
	} else if(type == 'destination') {
		if(confirm(Message)) window.open('/destination.asp?sAction=remove&nDestinationID='+nID+'&nCountryID='+nCountryID, '_self')
	} else if(type == 'action') {
		if(confirm(Message)) window.open('/action.asp?sAction=remove&nActionID='+nID+'&nCountryID='+nCountryID, '_self')
	} else if(type == 'photo') {
		if(confirm(Message)) window.open('/photo.asp?sAction=remove&nPhotoID='+nID+'&nCountryID='+nCountryID+'&nDestinationID='+nDestinationID+'&nActionID='+nActionID, '_self')
	}
}

function ShowAnimationUpload() {
	document.getElementById('footer').innerHTML += '<div id="animationupload"><img src="/data/xsl/img/animation-upload1.gif" alt="" border="0" width="150" height="100" /></div>'
	document.getElementById('animationupload').style.top = document.body.scrollTop + 200
}

function ImgWrite(Name)
{
	document.write('<img src="/data/img/start/'+Name+'.jpg" alt="" border="0" width="743" height="400" />');
}

function email(Before, After, Name){
	if(Name=='') {
		document.write('<a href="' + 'mailto:' + Before + '@' + After + '">' + Before + '@' + After + '</a>')
	}
	else {
		document.write('<a href="' + 'mailto:' + Before + '@' + After + '">' + Name + '</a>')
	}
}

//vypsani flashe
function FlashWrite_Banner1() {
	if (Flash())
	{
		document.write('<object width="120" height="600">');
		document.write('<param name="movie" value="http://www.ifaw.org/ifaw/dimages/custom/6_banners/skyscraper-2-english.swf?clickTAG=http://www.ifaw.org" />');
		document.write('<embed src="http://www.ifaw.org/ifaw/dimages/custom/6_banners/skyscraper-2-english.swf?clickTAG=http://www.ifaw.org" width="120" height="600"></embed>');
		document.write('</object>');
	}
}
function FlashWrite_Banner2() {
	if (Flash())
	{
		document.write('<object width="300" height="250">');
		document.write('<param name="movie" value=http://www.ifaw.org/ifaw/dimages/custom/6_banners/conveyor-animals-english2.swf?clickTAG=http://www.ifaw.org>');
		document.write('<embed src=http://www.ifaw.org/ifaw/dimages/custom/6_banners/conveyor-animals-english2.swf?clickTAG=http://www.ifaw.org width="300" height="250"></embed>');
		document.write('</object>');
	}
}
 


//vypsani flashe
function FlashWrite_Logo() {
	if (Flash())
	{
		document.write('<object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="190" height="120" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000">');
		document.write('<param name="movie" value="/data/flash/logo.swf" />');
		document.write('<param name="quality" value="high" />');
		document.write('<param name="bgcolor" value="#ffffff" />');
		document.write('<param name="wmode" value="transparent"/>');
		document.write('<param name="menu" value="false"/>');
		document.write('<param name="allowScriptAccess" value="sameDomain" />');
		document.write('<embed width="190" height="120" src="/data/flash/logo.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>');
		document.write('</object>');
	}
	else {document.write('<a href="/"><img src="/data/xsl/img/logo.gif" alt="logo dromoman" border="0" width="190" height="120" /></a>');}
	
}

function FlashWrite_Small() {
	if (Flash())
	{
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="441" height="245" id="map_small" align="middle">');
		document.write('<param name="movie" value="/worldMap.swf" />');
		document.write('<param name="quality" value="high" />');
		document.write('<param name="bgcolor" value="#ffffff" />');
		document.write('<param name="wmode" value="transparent"/>');
		document.write('<param name="menu" value="false"/>');
		document.write('<param name="allowScriptAccess" value="sameDomain" />');
		document.write('<embed src="/worldMap.swf" wmode="transparent" quality="high" bgcolor="#ffffff" width="441" height="245" name="map_small" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
		document.write('</object>');
	}
	else {document.write('<img src="/data/img/flashmapa.jpg" alt="flashmapa" border="0" width="441" height="245" />');}
}

function FlashWrite_Intro() {
	if (Flash())
	{
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="743" height="400" id="map_small" align="middle">');
		document.write('<param name="movie" value="/data/flash/intro.swf" />');
		document.write('<param name="quality" value="high" />');
		document.write('<param name="bgcolor" value="#ffffff" />');
		document.write('<param name="wmode" value="transparent"/>');
		document.write('<param name="menu" value="false"/>');
		document.write('<param name="allowScriptAccess" value="sameDomain" />');
		document.write('<embed src="/data/flash/intro.swf" wmode="transparent" quality="high" bgcolor="#ffffff" width="743" height="400" name="map_small" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
		document.write('</object>');
	}
	else {document.write('<img src="/data/img/default.jpg" alt="" border="0" width="743" height="400" />');}
}

function FlashWrite_Widget(UserID, UserName, widgetCountryId, bgColor) {
	if (Flash())
	{
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="742" height="387" id="map_Widget" align="middle">');
		document.write('<param name="movie" value="/worldMap_Widget.swf" />');
		document.write('<param name="quality" value="high" />');
		document.write('<param name="bgcolor" value="#'+bgColor+'" />');
		document.write('<param name="menu" value="false"/>');
		document.write('<param name="FlashVars" value="userId='+UserID+'&userName='+UserName+'&widgetCountryId='+widgetCountryId+'" />');
		document.write('<param name="allowScriptAccess" value="sameDomain" />');
		document.write('<embed src="/worldMap_Widget.swf" flashvars="userId='+UserID+'&userName='+UserName+'&widgetCountryId='+widgetCountryId+'" quality="high" bgcolor="#'+bgColor+'" width="743" height="387" name="map_Widget" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
		document.write('</object>');
	}
	else {document.write('<img src="/data/img/flashmapa_Widget.jpg" alt="" border="0" width="742" height="387" />');}
}

function FlashWrite_OurWorld() {
	if (Flash())
	{
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="942" height="491" id="map_big" align="middle">');
		document.write('<param name="movie" value="/worldMap_big.swf" />');
		document.write('<param name="quality" value="high" />');
		document.write('<param name="bgcolor" value="#ffffff" />');
		document.write('<param name="wmode" value="transparent"/>');
		document.write('<param name="menu" value="false"/>');
		document.write('<param name="allowScriptAccess" value="sameDomain" />');
		document.write('<embed src="/worldMap_big.swf" wmode="transparent" quality="high" bgcolor="#ffffff" width="942" height="491" name="map_big" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
		document.write('</object>');
	}
	else {document.write('<img src="/data/img/flashmapa-big.gif" alt="" border="0" width="942" height="491" />');}
}

function FlashWrite_User(UserID) {
	if (Flash())
	{
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="942" height="491" id="map_big" align="middle">');
		document.write('<param name="movie" value="/worldMap_User.swf" />');
		document.write('<param name="quality" value="high" />');
		document.write('<param name="bgcolor" value="#ffffff" />');
		document.write('<param name="wmode" value="transparent"/>');
		document.write('<param name="menu" value="false"/>');
		document.write('<param name="FlashVars" value="userId='+UserID+'" />');
		document.write('<param name="allowScriptAccess" value="sameDomain" />');
		document.write('<embed src="/worldMap_User.swf" flashvars="userId='+UserID+'" wmode="transparent" quality="high" bgcolor="#ffffff" width="942" height="491" name="map_big" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
		document.write('</object>');
	}
	else {document.write('<img src="/data/img/flashmapa-big.gif" alt="" border="0" width="942" height="491" />');}
}

function FlashWrite_MapCountry(StrongName) {
	if (Flash())
	{
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="375" height="299" id="mapcountry" align="middle">');
		document.write('<param name="movie" value="/data/flash/map/'+StrongName+'.swf" />');
		document.write('<param name="quality" value="high" />');
		document.write('<param name="bgcolor" value="#ffffff" />');
		document.write('<param name="wmode" value="transparent"/>');
		document.write('<param name="menu" value="false"/>');
		document.write('<param name="allowScriptAccess" value="sameDomain" />');
		document.write('<embed src="/data/flash/map/'+StrongName+'.swf" wmode="transparent" quality="high" bgcolor="#ffffff" width="375" height="299" name="mapcountry" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
		document.write('</object>');
	}
	else {document.write('<img src="/data/flash/map/default.jpg" alt="" border="0" width="375" height="299" />');}
}

//vypsani flashe
function FlashWrite_Banner(sFullPath, nWidth, nHeight) {
	if (Flash())
	{
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+nWidth+'" height="'+nHeight+'" align="middle">');
		document.write('<param name="movie" value="'+sFullPath+'" />');
		document.write('<param name="quality" value="high" />');
		document.write('<param name="bgcolor" value="#2e3c8c" />');
		document.write('<param name="wmode" value="transparent"/>');
		document.write('<param name="menu" value="false"/>');
		document.write('<param name="allowScriptAccess" value="sameDomain" />');
		document.write('<embed src="'+sFullPath+'" wmode="transparent" quality="high" bgcolor="#2e3c8c" width="'+nWidth+'" height="'+nHeight+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
		document.write('</object>');
	}
}


function Flash() {
var state
var plugin = 'Shockwave Flash'
var IEGoesToURL = true
if ((navigator.plugins && navigator.plugins[plugin]) || (IEGoesToURL && navigator.appName.indexOf('Microsoft') != -1 && navigator.appVersion.indexOf('Mac') == -1 && navigator.appVersion.indexOf('3.1') == -1)) {state = "true";} else {state = "false";}
return state
}

//nastaveni obrazku s linkama do prava
function showlink(refresh) {
	if(refresh==1) {
		document.getElementById("bannerright").style.display = "none";
		if(navigator.appName == "Netscape") {location.replace(location.href);}
		else {location.reload();}
	}
	else {
		if(document.getElementById("bannerright")) {
			var leftposition = (document.body.scrollWidth)/2+492;
			document.getElementById("bannerright").style.left = leftposition;
			document.getElementById("bannerright").style.display = "block";
		}
	}
}


/*function SetColor() {

 zjistí typ prohlížeče a nabídne jim řešení
var browser = navigator.appName
var verze = parseInt(navigator.appVersion)
if (browser == "Microsoft Internet Explorer" & verze >= 4) {
		var arr = window.showModalDialog( "/data/xsl/colorss.htm", "#" + document.getElementById('sVisitedCountryColor').value, "help:no;center:yes;status:no;dialogWidth:385px;dialogHeight:270px" );
		if (arr != null) {
	  		document.getElementById('sVisitedCountryColor').value = arr.substring(1);
			document.getElementById('sVisitedCountryColor1').style.backgroundColor = "#" + arr.substring(1);
		}
  		else {
			document.getElementById('sVisitedCountryColor').value = "f57304";
alert('a');
			document.getElementById('sVisitedCountryColor1').style.backgroundColor = "#f57304";
		}
	}
	else { 
		var arr = window.open( "/data/xsl/colorss.htm", "#" + document.getElementById('sVisitedCountryColor').value, "help=no,Center=yes,status=no,Width=385,Height=270,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,modal=yes" );
	if (arr != null) {
	  		document.getElementById('sVisitedCountryColor').value = arr.substring(1);
			document.getElementById('sVisitedCountryColor1').style.backgroundColor = "#" + arr.substring(1);
		}
  		else {
			document.getElementById('sVisitedCountryColor').value = "f57304";
			document.getElementById('sVisitedCountryColor1').style.backgroundColor = "#f57304";
		}
	}
}*/

function PrintCountryInfo (CountryName) {
    //var sHTML = document.getElementById('countryinfomore').innerHTML
	//document.getElementById('countryinfomore').innerHTML = "<h1 class=\"display\">Why to visit " + CountryName + "</h1>"" + sHTML 
	//document.getElementById('countryinfomore').innerHTML = sHTML 
	window.print()
	//document.getElementById('countryinfomore').innerHTML = sHTML
}

function setActiveStyleSheet(title) {
    var i, a, main;
    for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
        if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
        a.disabled = true;
        if(a.getAttribute("title") == title) a.disabled = false;
        }
    }
}
function GoToPage(nPage, rewriter, anchor) {
	if (event.keyCode==13) {
		var SelectedPage = nPage.replace('page/', '')
		if (!anchor=='') {anchor = '#' + anchor}
		else {anchor=''}
		if(SelectedPage <= Math.abs(document.getElementById('nMaxPage').value) && SelectedPage >= 1) {
			if(rewriter == 1) {
				if(nPage==1) window.open(document.getElementById('sSearchURL').value + anchor, '_self')
				else window.open(document.getElementById('sSearchURL').value+nPage+'/' + anchor, '_self')
			}
			else {window.open(document.getElementById('sSearchURL').value+'nPage='+nPage + anchor, '_self')}
		}
		else {
			alert("Number is out of range!")
		}
	}
}
function CountryInfo(Show) {
    /* aktivace stylesheetu printnuti*/
    var i, a, main;
    for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
        if(a.getAttribute("rel").indexOf("style") != -1) {
            if(Show==1) a.disabled = false;
            else a.disabled = true;
    }
    }
	var leftposition = (screen.width/2)-284 //(942-746) sirka webu - sirka samotneho boxu
	document.getElementById('countryinfomore').style.left = leftposition;
	if(Show==1) document.getElementById('countryinfomore').style.display='block'
	else document.getElementById('countryinfomore').style.display='none'
}

function ShowHomeCountry(Show) {
// zjistí typ prohlížeče a nabídne jim řešení
var browser = navigator.appName
var verze = parseInt(navigator.appVersion)
if (browser == "Microsoft Internet Explorer" & verze >= 4) {howdisplay = "block"}
else {howdisplay = "table-row"}
	if(Show==1) {
		document.getElementById('homecountry_0').style.display="none";
		document.getElementById('homecountry_1-1').style.display=howdisplay;
		document.getElementById('homecountry_1-2').style.display=howdisplay;
		document.getElementById('homecountry_1-3').style.display=howdisplay;
	} else {
		document.getElementById('homecountry_0').style.display=howdisplay;
		document.getElementById('homecountry_1-1').style.display="none";
		document.getElementById('homecountry_1-2').style.display="none";
		document.getElementById('homecountry_1-3').style.display="none";
	}
}
function Couple(bCoupleValue) {
// zjistí typ prohlížeče a nabídne jim řešení
var browser = navigator.appName
var verze = parseInt(navigator.appVersion)
if (browser == "Microsoft Internet Explorer" & verze >= 4) {howdisplay = "block"}
else {howdisplay = "table-row"}
	if(bCoupleValue==true) {
		document.getElementById('bCouple').value=1;
		document.getElementById('Couple_1_1').style.display=howdisplay;
		document.getElementById('Couple_1_2').style.display=howdisplay;
		document.getElementById('Couple_1_2_select').disabled=false;
		document.getElementById('Couple_0_1').style.display="none";
		document.getElementById('Couple_0_2').style.display="none";
		document.getElementById('Couple_0_3').style.display="none";
		document.getElementById('Couple_0_4').style.display="none";
		document.getElementById('Couple_0_5').style.display="none";
		document.getElementById('Couple_0_5_select').disabled=true;
		document.getElementById('Couple_0_6').style.display="none";
	}
	else {
		document.getElementById('bCouple').value=0;
		document.getElementById('Couple_1_1').style.display="none";
		document.getElementById('Couple_1_2').style.display="none";
		document.getElementById('Couple_1_2_select').disabled=true;
		document.getElementById('Couple_0_1').style.display=howdisplay;
		document.getElementById('Couple_0_2').style.display=howdisplay;
		document.getElementById('Couple_0_3').style.display=howdisplay;
		document.getElementById('Couple_0_4').style.display=howdisplay;
		document.getElementById('Couple_0_5').style.display=howdisplay;
		document.getElementById('Couple_0_5_select').disabled=false;
		document.getElementById('Couple_0_6').style.display=howdisplay;
	}
}
var nProfileID
var sBGColor
function WidgetColor(profileid, bgcolor) {
	nProfileID = profileid
	sBGColor = bgcolor
	var left = (screen.width / 2) - 300
	var top = 300
	WindowSource = window.open('/getmymap.htm', '', 'leftmargin=0,topmargin=0,marginwidth=0,marginheight=0,toolbar=0,titlebar=0,menubar=0,location=0,scrollbars=1,resizable=0,width=500,height=150,left='+left+',top='+top)
	setInterval("InsertSource()",500)
}
// ceka se nez se nacte okno s textarea, kdyz nebudu testovat pak to spadne
function InsertSource() {
	if (WindowSource.document.getElementById('SourceCode')) {
		WindowSource.document.getElementById('SourceCode').value = '<iframe src="http://www.dromoman.com/widget.asp?nProfileID='+nProfileID+'&sBGColor='+sBGColor+'" frameborder="0" width="742" height="506" scrolling="no"></iframe>'
	}
	else {
		setInterval("InsertSource()",500)
	}
}

function Blog(type, nID, nCommentID, Name) {
// obsluha tlacitek blogu
	if(type=='deletecomment') {
		var Message = "Do you really remove comment : "+Name+"?";
		}
	if(type=='postrestore') {
		var Message = "Do you really restore post : "+Name+"?";
		}
	if(type=='postdelete') {
		var Message = "Do you really delete post : "+Name+"?";
		}
	if(type=='reply') {
		var Message = "Re : "+Name+"?";
		}
	else {
		var Message = "Do you really remove post : "+Name+"?";
	}
	
	if(type == 'postremove') {
		if(confirm(Message)) window.open('blog.asp?nPostID='+nID+'&sAction=postremove', '_self')
	}
	if(type == 'postrestore') {
		if(confirm(Message)) window.open('blog.asp?nPostID='+nID+'&sAction=postrestore', '_self')
	}
	if(type == 'postdelete') {
		if(confirm(Message)) window.open('blog.asp?nPostID='+nID+'&sAction=postdelete', '_self')
	}
	else if(type == 'deletecomment') {
		if(confirm(Message)) window.open('blog.asp?nPostID='+nID+'&nCommentID='+nCommentID+'&sAction=deletecomment', '_self')
	}
	else if(type == 'reply') {
	     // pokud je replay na komentar, naplni se ID parentskeho komentare a predvyplni se title
	     var commentParentID = document.getElementById('commentParentID');
         var commentTitle = document.getElementById('commentTitle');
         
         commentParentID.value = nID;
         commentTitle.value = Message;
	     document.getElementById('commentName').focus();
	}
	else if(type == 'countrytags') {
	     // precte se multiple select, do countryTags se ulozi retezec ve tvaru 'x-y,x,..'  - x je country, y state (y je mozno vynechat)
	     var countryTags = document.getElementById('countryTags');
         var selectedArray = new Array();
         var selectedCountry = document.getElementById('selector');
         var i;
         var count = 0;
         for (i=0; i<selectedCountry.options.length; i++) {
            if (selectedCountry.options[i].selected) {
              selectedArray[count] = selectedCountry.options[i].value;
              count++;
           }
         }
         countryTags.value = selectedArray;
	}
}
// ve foru zabrani listovani dropdownlistu po vybrani categorie fora
function forumcategory(form) {
	var sURL
	var nCategory = form.nCategoryID.value
	sURL = "/forum.asp"
	
  if(nCategory > 0 ){sURL += "?sAction=viewforum&nCategoryID=" + nCategory}
	form.nCategoryID.disabled = true;
	
  window.open(sURL, '_self')
	return false
}

function ClickOnPalete(hexColor){
  document.getElementById('VisitedCountryColor').value = hexColor;
  document.getElementById('sVisitedCountryColor1').style.background = '#' + hexColor;
  //document.all.sVisitedCountryColor.value = hexColor;
  //document.all.sVisitedCountryColor1.style.background = hexColor;
  document.getElementById('visitcolor').style.display='none';
  //alert('Selected!') 
}
