﻿function ShowDialog(url, object, width, height, title, scroll)
{
	if(scroll == undefined)
	{
		scroll = "no";
	}
	if(title == undefined)
	{
		title ="";
	}
	var sStyle	= "dialogWidth:" + width + "px;dialogHeight:" + height + "px;resizable:no;status:no;scroll:no;help:no;unadorned:yes;";
	var sURL = "/PublicFrames/ShowFrame.aspx?bodyurl=" + escape(url) + "&title=" + escape(title) + "&scroll=" + scroll;
	window.showModalDialog(sURL, object, sStyle);	
}


function GetString(url)
{
	var obj;
	if(window.XMLHttpRequest)
	{
          obj = new XMLHttpRequest();
	}
	else 
	{
		if(window.ActiveXObject)
		{
			obj = new ActiveXObject("Microsoft.XMLHTTP"); 
		}
	}
	obj.open("GET", url, false);
	obj.send();
	if(obj.readystate == 4)
	{
		return obj.responseText;
	}
	return "";
}

function OpenWindow(url, width, height, windowName, resizable, paras) //toolbar, menubar, scrollbars, , location, status
{
	if(resizable == undefined)
	{
		resizable = "yes"
	}
	var style = "width=" + width + ",height=" + height + ",resizable=" + resizable;
	
	if(paras != undefined)
	{
		style += "," + paras;
	}
	window.open(url, windowName, style);
}

function UrlDecode(src)
{
	src = src.replace(/\+/gi, " ");
	return unescape(src);
}

function UrlEncode(src)
{
	return escape(src);
}

function OpenImage(filePath, detailName)
{
    OpenWindow("/" + filePath, screen.width-200, screen.height-100, detailName);
}

function BackToDefaultPage()
{
    document.parentWindow.parent.location.href = "/";
}