

function set_div_style(obj,id,top,left,width,height,position,border,cursor,background,filter)
{
    var obj = obj;
    obj.id = id?id:null;
    obj.style.top = top?top:0;
    obj.style.left = left?left:0;
    obj.style.width = width?width:0;
    obj.style.height = height?height:0;
    obj.style.position = position?position:"static";
    obj.style.border = border?border:"1px #000 solid";
    obj.style.cursor = cursor?cursor:"default";
    obj.style.background = background?background:"";
    obj.style.filter=filter?"Alpha(Opacity="+filter+")":0;
    return obj
}

function $(id)
{
	var obj = document.getElementById(id)?document.getElementById(id):null;
	return obj;
}

function open_the_set(id,width,height,menu_text,ifrsrc)
{
	var lw = document.createElement("div");
	var lw2 = document.createElement("div");
	//var loading = document.createElement("div");
	
	var lw_id = id + "_id";
	var lw2_id = id + "_id2";
	//var loading_id = "loading"
	
	//var lw2_left = window.screen.width/2-width/2;
	var lw2_left = document.body.scrollWidth/2 - width/2;
	var max_scroll_width = $("full_height").style.width;
	var max_scroll_height = $("full_height").style.height;
	
	if(id=="set_tools")
	{
		var lw2_top = window.screen.availHeight/2 - 210;
	}
	else
	{
		var lw2_top = window.screen.availHeight/2-300;
	}
	
	var loading_top = lw2_top + 100; 
	
	var lw = set_div_style(lw,lw_id,0,0,max_scroll_width,window.parent.document.body.scrollHeight,"absolute","0px solid #c0d4db","default","#cccccc",30);
	var lw2 = set_div_style(lw2,lw2_id,lw2_top,lw2_left,width,height,"absolute","1px solid #c0d4db","default","#ffffff");
	//var loading = set_div_style(loading,loading_id,loading_top,lw2_left,50,3,"absolute","0px solid #c0d4db","default","#fff");
	
	
	document.body.appendChild(lw);
	document.body.appendChild(lw2);
	//document.body.appendChild(loading);
	
	//var loadhtml = '<img alt="loading" src="../images/loading.gif" />';
	
	var htmlall="<iframe id='"+id+"' name='"+id+"' src='"+ifrsrc+"' scrolling='no'  frameborder='0' style='width:100%;height:100%;'></iframe>";
	
	lw2.innerHTML = htmlall;
	
	//loading.innerHTML = loadhtml;
	
	lw.onclick=function()
	{
		on_close();
	}
}

function on_close()
{
	if($("set_tools_id"))
    {
        var lw = $("set_tools_id");
        var lw2 = $("set_tools_id2");
        //document.getElementById('set_tools').src = 'temp.htm';
        document.body.removeChild(lw);
        document.body.removeChild(lw2);            
    }
}

function goto_config()
{
	open_the_set("set_tools",440,200,"Setup","/FlashChatRoom/ChatUserInfo.aspx");
	//open_the_set("set_tools",527,100,"Setup","test.htm");
}