
function Currency() {
	
	var curr = document.getElementByID('curren').value;
	document.location = 'index.php?page=<?=$page?>&type=<?=$HostingType?>&curr=';
//	document.location = "index.php?page=home";
}

function TourSelector(){
	
	var SelectId = document.getElementById("tour_selector").value;
	
	if( SelectId == 7 || SelectId == 11 ){
		
		if( SelectId == 7 ){
		
			var page = "daily_tours";	
		}
		else{
			
			var page = "multy_day_tours";	
		}
		
		document.location = "index.php?page=" + page + "&book_ID=1";
	}
}

function for_mozilla(id1, id2) {
	
	document.getElementById(id1).value = id2;
}

function IsEmailAddress(mail){
	
	var addressPattern = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
	return addressPattern.test(mail);
}

function jump_to_pass(){
	
	document.getElementById('hidden_pass').value = document.getElementById('password_tmp').value;
}

function OnPasswordFocus(){
	
	document.getElementById('pass_td').innerHTML = "<input type='password' name='password_tmp' id='password_tmp' style='width:110px;'>";
	document.getElementById('password_tmp').focus();
}

function isPhoneNumber(phone){
	
	var detect;
	var CharArray = new  Array(' ', '(', ')', '+', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
	
	for( var j=0; j < phone.length; j++ ){
		
		var PhoneChar = phone.substring( j, j+1 );
		
		detect = false;
		
		for( var z=0; z < CharArray.length; z++ ){
			
			if( PhoneChar == CharArray[z] ){
				
				detect = true;
			} 
		}
		
		if(detect == false){
			
			break;
		}
	}
	
	if(phone.length<5){
		
		detect = false;
	}
	
	return detect;
}

function detect(){ 
		
	if( document.cont_form.mail.value == "" || !IsEmailAddress(document.c_form.c_email.value) ){
		
		alert('Email address is incorrect. Please type real email address.');
		document.cont_form.mail.focus();
		return false;
	}
			
	return true;
}


function display_tour() {
	
	document.getElementById('tr_armenia').style.display = 'none';
	if( document.getElementById('tr_tours').style.display == 'none' ) {

		document.getElementById('tr_tours').style.display = 'block';
	}
	else {

		document.getElementById('tr_tours').style.display = 'none';
	}	
}

function display_armenia() {
	
	document.getElementById('tr_tours').style.display = 'none';
	if( document.getElementById('tr_armenia').style.display == 'none' ) {

		document.getElementById('tr_armenia').style.display = 'block';
	}
	else {

		document.getElementById('tr_armenia').style.display = 'none';
	}	
}


function displays(page) {
	
	if( page == 'daily_tours' || page == 'individual_tours' || page == 'multy_day_tours' || page == 'hiking_tours' ) {
		
		document.getElementById('tr_tours').style.display = 'block';
	}
	if( page == 'armenia_general' || page == 'armenia_language' || page == 'armenia_sights' || page == 'armenia_history' || page == 'armenia_architecture' || page == 'armenia_culture' ) {
		
		document.getElementById('tr_armenia').style.display = 'block';
	}
}

function booking_detect() {
	
	if( document.book_form.book_name.value == "" ){
		
		alert('Please enter your Name');
		document.book_form.book_name.focus();
		return false;
	}
	
	if( document.book_form.book_surname.value == "" ){
		
		alert('Please enter your Surname');
		document.book_form.book_surname.focus();
		return false;
	}	
	
	if( document.book_form.book_phone.value == "" || !isPhoneNumber(document.book_form.book_phone.value) ){
		
		alert('Phone number is incorrect. Please type real phone number.');
		document.book_form.book_phone.focus();
		return false;
	}
	
	if( document.book_form.book_email.value == "" || !IsEmailAddress(document.book_form.book_email.value) ){
		
		alert('Email address is incorrect. Please type real email address.');
		document.book_form.book_email.focus();
		return false;
	}
	
	if( document.book_form.book_comment.value == "" ){

		alert('Please enter your Comment');
		document.book_form.book_comment.focus();
		return false;
	}
	
	return true;
}

function window_open() {
	
	myWin= open("", "displayWindow", 
	"width=1020,height=720,status=no,toolbar=no,menubar=no,location=no,directories=no,scrollbars=no");
	// ??????? ?????? document ??? ??????????? ??????
	myWin.document.open();  
	// ???????????? ????? ????????
	myWin.document.write("<html><head><title>Map of Armenia");
	myWin.document.write("</title></head><body>");
	myWin.document.write("<img src='ArmeniaMap.jpg'>");
	myWin.document.write("</body></html>");
	// ??????? ???????? - (?? ?? ????!)
	myWin.document.close();
}

function div_visible() {
	
	document.getElementById('div_name').style.visibility = 'visible';
}

function tr_visible(tr_id) {
	
	if ( tr_id == 'tr_month' ) {
		
		document.getElementById('tr_year').style.display = 'none';
		document.getElementById('tr_month').style.display = 'block';		
	} 
	else {
		
		document.getElementById('tr_month').style.display = 'none';
		document.getElementById('tr_year').style.display = 'block';
	}
}