function create_window(_id, _title, _width, _height){

	var content='';

	var params =
	{
	   BorderWidth : 0,
	   ContentHTML : content,
	   ContentPadding : 0,
	   CloseBoxSrc : 'img/closebox.gif',
	   Height : _height,
	   InnerBorderWidth : 0,
	   OuterBorderColor : '#3973ad',
	   Resizable : 'None',
	   ResizeBoxHeight : 7,
	   ResizeBoxSrc : 'img/resize7blue.gif',
	   ResizeBoxWidth : 7,
	   Shadow : false,
	   StatusBarHeight : 17,
	   StatusColor : 'white',
	   TitleBarText : _title,
	   TitleColor : '#C8E79E',
	   TitleFontSize : 10,
	   TitleFontColor: 'Black',
	   ContentFontColor : 'Navy',
	   Width: _width,
	   Id  : _id
	}
	return (new FerantDHTMLWindow(params));

}


function create_popup_menu(_id, _width, _height, _content){

	var params =
	{
	   BorderWidth : 0,
	   Top: 100,
	   Left: 100,
	   CloseBoxHeight : 1,
	   CloseBoxSrc : 'img/closeboxgray.gif',
	   Height : _height,
	   Width: _width,
	   CloseBoxWidth : 1,
	   ContentHTML : _content,
	   ContentPadding : 1,
	   Dragable : 'None',
	   OuterBorderWidth : 0,
	   Resizable : 'None',
	   StatusBarHeight : 0,
	   StatusBarAlign : 'left',
	   StatusColor : 'white',
	   TitleBarHeight : 1,
	   TitleBarText : 'menu',
	   TitleBarAlign : 'center',
	   TitleColor : 'white',
	   TitleFontSize : 0,
	   TitleFontColor : 'Black',
	   ContentFontSize : 11,
	   ContentFontFamily : 'verdana, sans-serif',
	   ContentFontColor : 'Black',
	   Id  : _id
	}
	return (new FerantDHTMLWindow(params));
}

var global_post_array=null;
var global_url=null
var global_unique_iframe_name=null;
var global_unique_form_name=null;
var global_block_refresh=new Array();
var global_unique_block_id=null;

function getHTMLBody(iFrameEl){
	var doc = null;
	if (iFrameEl.contentDocument) { // For NS6
		doc = iFrameEl.contentDocument;
	} else if (iFrameEl.contentWindow) { // For IE5.5 and IE6
		doc = iFrameEl.contentWindow.document;
	} else {
		alert("Error: could not find sumiFrame document");
		return;
	}
	return doc;
}

function get_form_text(){
	var in_iframe='';
	in_iframe+='<form name="'+global_unique_form_name+'" id="'+global_unique_form_name+'" method="post" action="'+global_url+'">';
	for (var key in global_post_array) {
		var input_name=key.toString();
		var input_value=global_post_array[key].toString();
		in_iframe+='<input type="hidden" name="'+input_name.replace(/\"/g, "&quot;")+'" value="'+input_value.replace(/\"/g, "&quot;")+'">\n';
	}
	in_iframe+='</form>';
	return in_iframe;
}

function submit_form(){
	frame=getHTMLBody(document.getElementById(global_unique_iframe_name));
	frame.getElementById(global_unique_form_name).submit();
}


function open_location_in_window(_wind, _url, _post_array){
	if (_post_array) {
		// get unique names
		global_url=_url;
		global_post_array=_post_array;
		do {
			global_unique_iframe_name='global_unique_iframe_name_'+Math.round(Math.random()*1000000);
			global_unique_form_name='global_unique_form_name_'+Math.round(Math.random()*1000000);
			global_unique_block_id=Math.round(Math.random()*1000000);
		} while (document.getElementById(global_unique_iframe_name) || document.getElementById(global_unique_form_name) || global_block_refresh[global_unique_block_id]);
		// insert iframe with contents to "window"
		var content="<IFRAME id='"+global_unique_iframe_name+"' height='100%' width='100%' frameborder='0' onLoad='if (global_block_refresh[global_unique_block_id]) return; else {global_block_refresh[global_unique_block_id]=true;var a=getHTMLBody(document.getElementById(global_unique_iframe_name));a.body.innerHTML=get_form_text();setTimeout(\"submit_form();\", 0);}'></IFRAME>";
	} else {
		var content='<IFRAME src="'+_url+'" height="100%" width="100%" frameborder="0"></IFRAME>';
	}
	_wind.UpdateContentHTML(content);
	_wind.OpenWindow();
}


