/*
This function can be used to add unlimited window.onload events.
*/
function addLoadEvent(func) {
    var oldonload = window.onload;
        if (typeof window.onload != 'function') {
            window.onload = func;
        } else {
            window.onload = function() {
            if (oldonload) {
                oldonload();
            }
            func();
        }
    }
}

/*
This function is used to disable the form to help prevent 
double submits.

Usage: 
<form onsubmit="submitAndDisableForm(this);return void;">
*/
function submitAndDisableForm(form)
{
    form.submit();
    var elements = form.elements();
    for(var i=0;i<elements.length;i++) {
        elements[i].disabled=true;
    }
}

/*
This function can be used to disable the "Enter" key for 
stricter control over forms.
Usage:
document.onkeypress = disableEnterKey;
*/
function disableEnterKey(e)
{
     var key;
     if(window.event)
          key = window.event.keyCode;     //IE
     else
          key = e.which;     //firefox

     if(key == 13)
          return false;
     else
          return true;
}


if (document.images) {

 back_to_homeon = new Image();
 back_to_homeon.src = "/images/back_to_home_on.jpg";

 back_to_homeoff = new Image();
 back_to_homeoff.src = "/images/back_to_home_off.jpg";

 choose_another_regionon = new Image();
 choose_another_regionon.src = "/images/choose_another_region_on.jpg";

 choose_another_regionoff = new Image();
 choose_another_regionoff.src = "/images/choose_another_region_off.jpg";

 about_uson = new Image();
 about_uson.src = "/images/menu_about_us_on.gif";

 about_usoff = new Image();
 about_usoff.src = "/images/menu_about_us_off.gif";

 contact_uson = new Image();
 contact_uson.src = "/images/menu_contact_us_on.gif";

 contact_usoff = new Image();
 contact_usoff.src = "/images/menu_contact_us_off.gif";

 testimonialson = new Image();
 testimonialson.src = "/images/menu_testimonials_on.gif";

 testimonialsoff = new Image();
 testimonialsoff.src = "/images/menu_testimonials_off.gif";

 whats_newon = new Image();
 whats_newon.src = "/images/menu_whats_new_on.gif";

 whats_newoff = new Image();
 whats_newoff.src = "/images/menu_whats_new_off.gif";

 hotel_networkon = new Image();
 hotel_networkon.src = "/images/menu_hotel_network_on.gif";

 hotel_networkoff = new Image();
 hotel_networkoff.src = "/images/menu_hotel_network_off.gif";

 advertisingon = new Image();
 advertisingon.src = "/images/menu_advertising_on.gif";

 advertisingoff = new Image();
 advertisingoff.src = "/images/menu_advertising_off.gif";

 online_networkon = new Image();
 online_networkon.src = "/images/menu_online_network_on.gif";

 online_networkoff = new Image();
 online_networkoff.src = "/images/menu_online_network_off.gif";

}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function shareVideo(){}

function ShareVideo(video) {
	var width = 470;
	var height = 400;
	LeftPosition = (screen.width) ? (screen.width-width)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-height)/2 : 0;
	OpenWin = 
	this.open("http://new.visitortv.com/sharevideo.php?video_id="+video,"PopupWindow","toolbar=no,width="+width+",height="+height+",left="+LeftPosition+",top="+TopPosition+",directories=no,status=no,scrollbars=yes,resize=no,menubar=no")
}

