// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

function openwindow(imgurl,passwidth,passheight)
	{
	var urlwindow = imgurl;
	var paramwindow = "width="+passwidth+",height="+passheight+",directories=no,location=no,menubar=no,resizable=no,scrollbars=no"
	window.open(urlwindow,"Anandatravel",paramwindow);
	}

function swichtopicimg(topic)
{
   var imgurl = "url(http://www.hainananandatravel.com/web/images/packages_" + topic + ".jpg)";
   //alert(imgurl);
  document.getElementById('packages_right').style.backgroundImage = imgurl;
}

function Change_attraction_menu_on(element)
{
   
   if (document.getElementById('under_menu_sights').style.display=="none")
   {
      $(element).up('.sights').style.backgroundImage = "url(http://www.hainananandatravel.com/web/images/menuleftlast_bg.gif)";
      new Effect.SlideDown('under_menu_sights',{duration: 0.2})
   }
   
   if (document.getElementById('under_menu_sights').style.display=="")
   {
       $(element).up('.sights').style.backgroundImage = "url(http://www.hainananandatravel.com/web/images/menuleft_bg.gif)";
       new Effect.SlideUp('under_menu_sights',{duration: 0.2})
   }
   //alert(document.getElementById('under_menu').style.display)
}


function Change_attraction_menu_on2(element)
{
   
   if (document.getElementById('under_menu_leisure').style.display=="none")
   {
      new Effect.SlideDown('under_menu_leisure',{duration: 0.2})
   }
   
   if (document.getElementById('under_menu_leisure').style.display=="")
   {
       new Effect.SlideUp('under_menu_leisure',{duration: 0.2})
   }
   //alert(document.getElementById('under_menu').style.display)
}


function Init_attraction_menu(id)
{   
    try {
    Element.toggle(id);
    } catch (e) { alert('RJS error:\n\n' + e.toString()); alert('Element.toggle(id);'); throw e };

}

function Init2_attraction_menu(id1,id2)
{
   document.getElementById(id1).style.background = "#ffffff url(http://www.hainananandatravel.com/web/images/images/menuleft_arrowon.gif) no-repeat 0px 5px";  
   document.getElementById(id2).style.color="#e92e0b";
}





function validate_required(field,alerttxt)
{
with (field)
{
if (value==null||value=="")
  {alert(alerttxt);return false}
else {return true}
}
}


function validate_contactform(thisform)
{
with (thisform)
{
	if (validate_required(contact_name,"Your name must be fill out !")==false)
	{contact_name.focus();return false;}
	
	if (validate_required(contact_email,"Your Email must be fill out !")==false)
	{contact_email.focus();return false;}
	
	if (validate_required(contact_subject,"The subject must be fill out !")==false)
	{contact_subject.focus();return false;}
	
	if (validate_required(contact_body,"The message must be fill out !")==false)
	{contact_body.focus();return false;}

}
}