// JavaScript Document
var ie4 = document.all;
var ns4 = document.layers;
var ns6 = document.getElementById && !document.all; 

function changeStyle(obj,prop,val){
	obj.style[prop] = val;
} 

function dropDown(state,objRef){
	var stateStr, obj;
		if (state == "hide")
		{
			stateStr = "hidden";
		} else if (state == "show" )
		{
			stateStr = "visible";
		}
		if (document.getElementById)
		{
			obj = document.getElementById(objRef);
			obj.style.visibility = stateStr;
		}
}

previewWin = 0;
animWin = 0;
glossWin = 0;
UploadWin = 0;

function GetPreview(objRef,type) {

	var form = MM_findObj(objRef);
	var preForm = MM_findObj("previewForm");
	if (!form.description.value)
	{
		alert("Please enter description text");
		return false;
	} else 
	{
		var URLStr = "preview.asp";
		var width = 470;
		var height = 500;
		var x = 10 ;
		var y = 10;
		preForm.desc.value = form.description.value;
		preForm.title.value = form.title.value;
		preForm.type.value = type;
		if (type == "item")
		{
		preForm.extra1.value = form.long_title.value;
		}else if (type == "tip")
		{
		preForm.extra1.value = form.txtAuthor.value;
		}
		previewWin = popRelWin(previewWin, "previewWin", URLStr + "?type=" + type, width, height, x, y);
		preForm.submit();
	}
}

function callPopWin(href, width, height) {
	if(width < 1 || width == "") {
		width = 450;
	}
	if(height< 1 || height == "") {
		height = 450;
	}
	
	popRelWin(glossWin,'glossWin',href,width,height,10,10);
}

function uploaderPopUp(href, width, height) {
	if(width < 1 || width == "") {
		width = 450;
	}
	if(height< 1 || height == "") {
		height = 350;
	}
	popRelWin(UploadWin,'UploadWin',href,width,height,10,10);
}

function popRelWin(PopUpWin, winName, URLStr, width, height,offsetx, offsety){
	
	if (!offsetx || !offsety) {
		offsetx = offsety = 10;
	}
	var x
	var y
		if ((isNaN(window.screenX)&&document.getElementById)|| (document.all) || (document.layers)) {
			x=window.screenLeft + offsetx;
			y=window.screenTop + offsety;
		} else {
			x=window.pageXOffset - offsetx;
			y=window.pageYOffset- offsety;
			}
			
	var strProp
	strProp += "toolbar=no,";
	strProp += "location=no,";
	strProp += "directories=no,";
	strProp += "status=no,";
	strProp += "menubar=no,";
	strProp += "scrollbars=yes,";
	strProp += "resizable=yes,";
	strProp += "copyhistory=yes,";
	strProp += "width="+width+",";
	strProp += "height="+height+",";
	strProp += "left="+ x +",";
	strProp += "top="+ y +",";
	strProp += "screenX="+ x +",";
	strProp += "screenY="+ y +" ";
	
	if(PopUpWin)
	{
    if(!PopUpWin.closed) PopUpWin.close();
  }
	if (URLStr.indexOf("?") > -1) 
	{
		URLStr += "&";
	} else
	{
		URLStr += "?";
	}
	URLStr += "referer=" + escape(window.location);
  PopUpWin = window.open(URLStr, winName, strProp);
	PopUpWin.focus();
}