// Generic DocShop (non-namespaced, boo!) functions
// TODO: import into EI namespace
// 
// Requires: ei.js, prototype.js
// 

// jump to link drop down menu
//-----------------------------------------------------
function JumpToLink ()
{
    // Identify associative array for which to pop new window
    var newWinArr =  new Array();
    var linkForm  = this.document.select_specialty_menu;
    var selMenu   = linkForm.links;
    var selItem   = selMenu.options[selMenu.selectedIndex];

        if ( newWinArr[selItem.text] > 0 )
                 window.open(selItem.value, 'PropertyWindow'+selMenu.selectedIndex, "");
        else
                  window.location.href = selItem.value;
}

// stats backward compatibility
//-----------------------------------------------------
function showLayer(obj_id) { 
	if (document.getElementById) {
		var obj = document.getElementById(obj_id);
		if (obj) {
			obj.style.display = 'block';
			obj.style.visibility = 'visible';
		}
	}
}
function hideLayer(obj_id) { 
	if (document.getElementById) {
		var obj = document.getElementById(obj_id);
		if (obj) {
			obj.style.display = 'none';
			obj.style.visibility = 'hidden';
		}
	}
}

// clears and replaces text in input fields and textareas
// -----------------------------------------------------
function clearText(f) {
	if (f.defaultValue==f.value) { f.value = "" }
}
function replaceText(f) {
	if (f.value=="") { f.value = f.defaultValue }
}

// onchange jump menu - assumes absolute url as value
// -----------------------------------------------------
function selectJump(s) {
	if (s.selectedIndex > 0) location.href=s[s.selectedIndex].value;
}

//------------------- pop up SWFs on /video/ -------------------//
function popUpSWF(url, type, Width, Height, arg1, arg2, arg3){
	tools = "resizable=no,toolbar=no,location=no,directories=no,status=no,scroll=no,scrollbars=no,menubar=no,width="+Width+",height="+Height+",left=0,top=0";
	if(type == "mp"){
		newWindow = window.open(url+"?bandwidth="+arg1+"&video="+arg2+"&lan="+arg3, 'newWin', tools);
	}
	if(type == "mc"){
		newWindow = window.open(url+"?category="+arg1+"&videoNum="+arg2, 'newWin', tools);
	}
	if(type == "media"){
		newWindow = window.open(url+"?bandwidth="+arg1+"&video="+arg2+"&lan="+arg3, 'newWin', tools);
	}
	newWindow.focus();
}
