function setValidators(controlName) {
	if(typeof(Page_Validators) != "undefined") {
		for(var i=0;i<Page_Validators.length;i++) {
			if(Page_Validators[i].id.indexOf(controlName + "_") != 0) {
				Page_Validators[i].enabled = false;
			}
		}
	}
}

var __pageHeight = 0;
var __pageWidth = 0;

function __setPageDims() {
	if(document.all) {
		__pageHeight=document.body.clientHeight; __pageWidth=document.body.clientWidth;
	} else {
		__pageHeight=window.innerHeight; __pageWidth=window.innerWidth;
	}
}

function __imagePopup(url, height, width, title) {
	__setPageDims();
	height=parseInt(height)+33;
	width=parseInt(width)+30;
	if(width<200) width=200;
	
	if(width>__pageWidth) width = __pageWidth;
	if(height>__pageHeight) height = __pageHeight;
	
	url = "/inigo/w3a_dyn/imageviewer.aspx?src=" + escape(url) + "&height=" + height + "&width=" + width + "&title=" + title;
	var imagePopup = window.open(url, "imagePopup", "height=" + height + ", width=" + width + ", resizable=yes, location=no, address=no, toolbar=no, scrollbars=1");	
	imagePopup.focus();
}

function __popup(url, title) {
	var popup = window.open(url, "popup");	
	popup.focus();
}

function checkForEnter(btnID, e){
	var keyCode = 0;
	var btnName = btnID.split("_").join(":");
	if(document.all)
		keyCode = e.keyCode;
	else
		keyCode = e.which;
	
	
	if(keyCode == 13) {
		e.returnValue = false;
		e.cancel = true;
		theform = document.forms[0];
		try {
			document.forms[0].elements[btnName].click();
		} catch(err) {
			// Disable the wrong button from firing which can occur by default
			// ensure current default button is enabled
			for(var i=0; i<theform.elements.length; i++) {
				var el = theform.elements[i];
				if(el.type == "submit" && el.name != btnName) {
					el.disabled = true;
				} else {
					el.disabled = false;
				}
			}
			
			if(typeof(theform.__EVENTTARGET) != "undefined") {
				if(typeof(__doPostBack) != "undefined") {
					theform.__EVENTTARGET.value = btnID;
					__doPostBack(btnID,'');
				} else {
					theform.__EVENTTARGET.value = btnID;
					// this won’t cause the form.onsubmit event to fire
					theform.submit();
				}
			}
		}
		return false;
	} else {
		return true;
	}
}

function updatePosition(id) {
    var div = document.getElementById(id);
}

function SetCookie (name, value) {
  var argv = SetCookie.arguments;
  var argc = SetCookie.arguments.length;
  var expires = (argc > 2) ? argv[2] : null;
  var path = "/";
  var domain = (argc > 4) ? argv[4] : null;
  var secure = (argc > 5) ? argv[5] : false;
  document.cookie = name + "=" + escape (value) +
    ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
    ((path == null) ? "" : ("; path=" + path)) +
    ((domain == null) ? "" : ("; domain=" + domain)) +
    ((secure == true) ? "; secure" : "");
}

function _replace(str, find, replace) {
    return str.split(find).join(replace);
}

function AdminEditorInit(ed, args) {
    if(typeof(ed) != "undefined")
        ed.get_contentArea().style.backgroundImage = "none";
}
