function ViewUploadPopup(UploadID, Width, Height)
{
        var top, left, w, h;

        w = parseInt(Width);

        h = parseInt(Height);

        if (!isNaN(w) && !isNaN(h))
        {
                top = window.screen.availHeight / 2 - w / 2;
                left = window.screen.availWidth / 2 - h / 2;
        } else
        {
                top = 100;
                left = 100;
        }

        window.open("/viewpicture.aspx?upid=" + UploadID, "Upload",
    "top="+top+",left="+left+",width="+Width+",height="+Height+", status=no,toolbar=no,menubar=no,location=no, resizeable=no, scrollbar=yes");

        return false;
}

function PopContact(path){
        window.open(path+'/home/contact.aspx','contact','height=670 width=800,scrollbars=yes');
}
function PopTour(path){
        window.open(path+'/page.aspx?page=tour/step_1.html','tour','width=622,height=438,location=no,toolbar=no,menubar=no,status=no');
}
function PopAbout(path){
        window.open(path+'/page.aspx?st=2&page=about.html','about','height=600 width=800,scrollbars=yes');
}
function PopAdvertise(path){
        window.open(path+'/advertise.aspx','advertise','height=600 width=800,scrollbars=yes');
}
function PopPrivacy(path){
        window.open(path+'/page.aspx?st=2&page=privacy.html','privacy','height=600 width=800,scrollbars=yes');
}
function PopTerms(path){
        window.open(path+'/page.aspx?st=2&page=terms.html','privacy','height=600 width=800,scrollbars=yes');
}
function PopHelp(path){
        window.open(path+'/page.aspx?st=2&page=help.html','help','height=600 width=800,scrollbars=yes');
}
function PopSweepstake(path){
        window.open(path+'/page.aspx?st=2&page=sweepstakes_rules.html','sweepstakes_rules','height=600 width=800,scrollbars=yes');
}
function Pop2257(path){
        window.open(path+'/page.aspx?st=2&page=rtalabel_notice.html','2257_Notice','height=500 width=800,scrollbars=yes');
}
function LaunchChat(UserID, SiteID)
{	
	var WinID = "";
	if (UserID > 0)
		WinID = "cid" + UserID;
	else if (SiteID > 0)
		WinID = "cid" + SiteID;
	
	window.open("/Chat/ChatInit.aspx?UserID=" + UserID + "&SiteID=" + SiteID, WinID, "width=450,height=340,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=no,left=0,top=0,screenx=50,screeny=50");
}
function LaunchChatRequest(originatinguserid){
        window.open(path+'/page.aspx?st=2&page=','Chat Invitation','height=600 width=800,scrollbars=yes');
}

function GetElementByName(ename)
	{
	var obj;

	if (document.all)
		{
		eval("obj = document.all.item(\"" + ename + "\")");
		}
	else if (document.layers)
		eval("obj = document.layers[\"" + ename + "\"]");
	else if (document.getElementById)
		eval ("obj = document.getElementById (\"" + ename + "\")");
	else	
		obj =  undefined;

	return obj;
}

function GetInputByName(fname, ename)
{
	var obj;
	
	if (document.all)
		eval ("obj = document.forms[\"" + fname + "\"].item(\"" + ename + "\");");
	else if (document.layers)
	{
		var f = document.forms[fname];
		return f[ename];
	}
	else if (document.getElementById)
		eval ("obj = document.getElementById (\"" + ename + "\")");

	return obj;
}

function get_input_by_name(fname, ename)
{
 var obj;
 
 eval ("obj = document.forms[\"" + fname + "\"].item(\"" + ename + "\");");
 
 return obj;
}

function open_window_maximized(windowURL, windowName)
{
	if (windowURL.length == 0 )
		return;
		
   var wOpen;
   var sOptions;

   sOptions = 'status=yes,menubar=yes,scrollbars=yes,resizable=yes,toolbar=yes';
   sOptions = sOptions + ',width=' + (screen.availWidth - 10).toString();
   sOptions = sOptions + ',height=' + (screen.availHeight - 122).toString();
   sOptions = sOptions + ',screenX=0,screenY=0,left=0,top=0';

   wOpen = window.open( '', windowName, sOptions );
   if (wOpen){
		wOpen.location = windowURL;
		//wOpen.focus();
		wOpen.moveTo( 0, 0 );
		wOpen.resizeTo( screen.availWidth, screen.availHeight );
		wOpen.opener.focus();
   }
   return wOpen;
}
function up_launchChat()
{
	window.open( "/userplane/wc.aspx", "UserplaneChatWindow", "width=600,height=450,toolbar=0,directories=0,menubar=0,status=0,location=0,scrollbars=0,resizable=1" );
}
