var d = document;

function new_window(url, win_name){
	win_name=window.open(url,win_name,'toolbar=no,scrollbars=yes,resizable=yes,width=600,height=460,status=no,left=100,top=100,screenX=100,screenY=100');
	win_name.focus();
}

function pic_win(url,wintitle){
	picwin=window.open('image.php?pic='+url+'&name='+wintitle,'picwin','toolbar=no,scrollbars=no,width=620,height=500,left=100,top=100,screenX=100,screenY=100,status=no');
	picwin.focus();
}

function print_window(url){
	printwin=window.open(url,'printwin','toolbar=no,scrollbars=yes,width=600,height=500')
	printwin.focus()
}

var d = document;
var browser = '';
var browserName=navigator.appName;
if (browserName=="Netscape") { 
	//alert("Hi Netscape User!");
	browser = 'ns';
} else 
{ 
	if (browserName=="Microsoft Internet Explorer") {
		//alert("Hi, Explorer User!");
		browser = 'ie';
	} else {
		//alert("What ARE you browsing with here?");
	}
}
if(browser=='ie'){

	function pickRecentProgID(idList, enabledList){
	    // found progID flag
	    var bFound = false;
	    for(var i=0; i < idList.length && !bFound; i++){
	        try{
	            var oDoc = new ActiveXObject(idList[i]);
	            o2Store = idList[i];
	            bFound = true;
	            for(var j=0;j<enabledList.length;j++)
	                if(i <= enabledList[j][1])
	                    Sarissa["IS_ENABLED_"+enabledList[j][0]] = true;
	        }catch (objException){
	            // trap; try next progID
	        };
	    };
	    if (!bFound)
	        throw "Could not retreive a valid progID of Class: " + idList[idList.length-1]+". (original exception: "+e+")";
	    idList = null;
	    return o2Store;
	};
	// pick best available MSXML progIDs
	_PIM_DOM_PROGID = pickRecentProgID(["Msxml2.DOMDocument.5.0", "Msxml2.DOMDocument.4.0", "Msxml2.DOMDocument.3.0", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XMLDOM"], [["SELECT_NODES", 2],["TRANSFORM_NODE", 2]]);
	_PIM_XMLHTTP_PROGID = pickRecentProgID(["Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"], [["XMLHTTP", 4]]);
	_PIM_THREADEDDOM_PROGID = pickRecentProgID(["Msxml2.FreeThreadedDOMDocument.5.0", "MSXML2.FreeThreadedDOMDocument.4.0", "MSXML2.FreeThreadedDOMDocument.3.0"]);
	_PIM_XSLTEMPLATE_PROGID = pickRecentProgID(["Msxml2.XSLTemplate.5.0", "Msxml2.XSLTemplate.4.0", "MSXML2.XSLTemplate.3.0"], [["XSLTPROC", 2]]);
	// we dont need this anymore
	pickRecentProgID = null;
}

function getXMLHTTP(){
	var A=null;
	if (document.all) {
		// IE
		A=new ActiveXObject(_PIM_XMLHTTP_PROGID)
	}
	if(!A && typeof XMLHttpRequest != "undefined") {
		// Mozilla
		A=new XMLHttpRequest()
	}
	return A
}

function getData(val,el,act){
	var xmlhttp = getXMLHTTP();
	if (xmlhttp) {
		xmlhttp.open("GET", "requests.php?do="+act+"&id="+val, true);
		xmlhttp.onreadystatechange=function() {
			var output='';
			if (xmlhttp.readyState == 4) {
				if (xmlhttp.status == 200) {
					output=xmlhttp.responseText;
					//output=xmlhttp.responseDocument;
					var funcName = eval(act+'Ready');
					funcName(el,output);
					/*
					if (document.getElementById(el)) {
						document.getElementById(el).innerHTML = output;
					}
					*/
				}
			}
		}
		xmlhttp.send(null);
	}
}

function menuReady(el,output) {
	output = output.replace(/^\s+/,'');
	output = output.replace(/\s+$/,'');

		var arrReq = new Array();
		arrReq = output.split(';');
		//var sel = document.outstore.tcardId;
		var opt = "";
		
		//for(prop in arrReq) if(!confirm(prop + ' = ' + arrReq[prop])) break;
		for(i=0;i<arrReq.length-1;i++){
			var arrEl = new Array();
			arrEl = arrReq[i].split(',');
//			id = arrEl[0];					
			opt =opt+  "<img src='design/004_ll.gif' border='0' />&nbsp;&nbsp;<a href='"+arrEl[0]+"' class='drop'>"+arrEl[1]+"</a><br>";
//			sel.options[sel.options.length] = opt;
		}
		document.getElementById(el).innerHTML = opt;
		document.getElementById(el).style.display = 'block';
//		document.getElementById(el).innerHTML = opt;
}
