﻿var urlSelect = null;

function navigate() {
    var url = urlSelect.value;
    if(url != "empty" && url.length > 0) {
        window.open(url);
    }
}

function fullScreen(url)
{
    var windowprops = "top=0,left=0,resizable=no,width=" + screen.width + ",height=" + screen.height + ",fullscreen=yes,scrollbars=auto";
    window.open(url, "popupPage", windowprops);
}

function keyboardSubmit(e, buttonid){
    var keycode;
    var bt = document.getElementById(buttonid);

    if (window.event) keycode = window.event.keyCode;
    else if (e) keycode = e.which;

    if (keycode == 13) {
        if (null != bt && (typeof bt == 'object')) {
        
            if (bt.dispatchEvent && (typeof bt == 'object') && typeof(bt.click) == 'undefined') 
                eval(bt.getAttribute('href'));           
            else 
                bt.click();
        }
        return false;
    } 
}

function enableValidatorsBoolean(id,ctrls,bool)
{
    var source = document.getElementById(id);

    if((source != undefined && ctrls != undefined) && (source.type == "checkbox" || source.type == "radio"))
        for (var i=0; i<ctrls.length; i++)
            ValidatorEnable(document.getElementById(ctrls[i]),(source.checked == bool));
}

function writeCookie(name,value,days)
{
    var expires = "";
    if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		expires = "; expires="+date.toGMTString();
	}
	document.cookie = name+"="+value+expires+"; path=/";
}

function addClickFunction(id) {
  var b = document.getElementById(id);
  if (b && typeof(b.click) == 'undefined') 
    b.click = function() {
      var result = true; 
      if (b.onclick) result = b.onclick();
      if (typeof(result) == 'undefined' || result) { eval(b.getAttribute('href')); }
    }
}