// JavaScript Document

page = window.location.href
page = page.substr(page.lastIndexOf("/")+1)
page = page.replace(".aspx", "")

img_arr = new Array()
img_arr[0] = "image_00.jpg"
img_arr[1] = "image_01.jpg"
img_arr[2] = "image_02.jpg"
img_arr[3] = "image_03.jpg"
img_arr[4] = "image_04.jpg"
img_arr[5] = "image_05.jpg"
img_arr[6] = "image_06.jpg"
img_arr[7] = "image_09.jpg"

function swap(str){
	
	obj=document.getElementById(str)
	
	if((obj&&str.indexOf(page)<0)||(page=="")){
		if(obj.className=="menu_item_on"){
			obj.className = "menu_item_off"
		}else{
			obj.className = "menu_item_on"
		}
	}
}
function randomize_photo(id){
	
	var rndm = Math.floor(Math.random()*7)
	
	obj=document.getElementById(id)
	
	if(obj){
		obj.src = "images/photos/"+ img_arr[rndm]
		obj.style.display = "block"
	}
}
function validate_form(field_str, form_id){
	
	field_arr = field_str.split(";")
	field_error = 0
	
	for(i=0;i<field_arr.length;i++){
		obj = document.getElementById(field_arr[i])
		if(obj){
			if(obj.value.length==0){
				obj.className = "field_error"
				field_error++
			}else{
				obj.className = "field_input"
			}
		}
	}
//	if(field_error>0){
//		alert("Please fill in the missing information and submit the form again. Thank you!")	
//	}else{
//		form_obj = document.getElementById(form_id)
//		if(form_obj){form_obj.submit()}
//	}
}

//function active_link(){

//	// CHANGE ACTIVE LINK
//	link_obj = document.getElementById("link_"+page)
//	
//	if(link_obj){
//		link_obj.style.color = "#3d8b99"
//	}	
//}

function active_link()
{
    //Make selected menu item match page
    str = "menu_"+page
	obj=document.getElementById(str)
	if(obj)
	{
	    obj.className = "menu_item_on"
	}
	link_obj = document.getElementById("link_"+page)
	if(link_obj)
	{
		link_obj.style.color = "#ffffff"
	}
	//Make selected menu item for take the tour
	if(page=='Contact?t=y')
	{
        obj=document.getElementById("menu_tour")
        if(obj)
        {
            obj.className = "menu_item_on"
            link_obj = document.getElementById("link_tour")
            {
	            if(link_obj)
	            {
		            link_obj.style.color = "#ffffff"
	            }                
            }
        }
	}
}
