﻿// JScript File
function ConfirmDelete(item, url)
{
    var Delete = window.confirm('Delete: ' + item + ' ?' );
    if ( Delete )
    {
        location.href = url;
    }
}

/*---------------- Auto height ------------------*/
function autofitIframe(id,height) 
{ 
    if (!window.opera && !document.mimeType && document.all && document.getElementById)
    { 
        parent.document.getElementById(id).style.height=height+"px";
    } 
    else if (navigator.appName == "Microsoft Internet Explorer")
    {
        document.getElementById(id).height=height+"px";
        /*document.getElementById(id).height=document.getElementById(id).contentWindow.document.body.scrollHeight+"px";*/
    }
    else 
    { 
       var high_ = 0; 
       high_ = this.document.body.scrollHeight;
       high_ = high_ + "px";
       parent.document.getElementById(id).style.height=height+"px";
    } 
} 
/*---------------- End Auto height ------------------*/

/*------------------- Menu --------------------------*/

var timeout         = 500;
var closetimer		= 0;
var ddmenuitem      = 0;


function mopen(id)
{	
	mcancelclosetime();

	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';

}

function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

document.onclick = mclose;

/*------------------- End Menu ---------------------*/

function LoadPopUp(Url, Mode, Width, Height, Top, Left)
{
    if (Top == null)
        Top = "200";
    if (Left == null)
        Left = "250";
    if (Mode == null)
        Mode = "_black"
        
    if (Height == null && Width == null)
    {
        window.open(Url, Mode, "menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,top="+Top+",left="+Left);
    }
    else
    {
        window.open(Url, Mode, "menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,top="+Top+",left="+Left+",height="+Height+",width="+Width);
    }
}

function LoadColorPicker()
{
    LoadPopUp('ColorPicker.aspx', '_Black', '200', '230');
}

function ConfirmLeave(item, url)
{
    var Leave = window.confirm('Are you sure you want to leave the group: ' + item + ' ?' );
    if ( Leave )
    {
        location.href = url;
    }
}

function ConfirmJoin(item, url)
{
    var Leave = window.confirm('Are you sure you want to join the group: ' + item + ' ?' );
    if ( Leave )
    {
        location.href = url;
    }
}
function Expand(id)
{
    var L = document.getElementById(id);
    var lblTitle = document.getElementById("Title_" + id);
    
    if (L.style.display == "" || L.style.display == "none") 
    {
        L.style.display = "block";
        lblTitle.innerHTML = "Hide Comments";
    }
    else
    { 
        L.style.display = "none";
        lblTitle.innerHTML = "Show Comments";
    }
}

function ExpandPromotion(id)
{
    var L = document.getElementById(id);
    if (id == "DisplayAmount")
    {
         if (L.style.display == "" || L.style.display == "none") 
         {
            var L1 = document.getElementById("DisplayPorcentage");
            L.style.display = "block";
            L1.style.display = "none";
         }
    }
    else
    {
        var L1 = document.getElementById("DisplayAmount");
        L.style.display = "block";
        L1.style.display = "none";
    }
}

function IsNum( Val )
{
	var Num = new Number( Val ) ;
	return( !isNaN( Num ) ) ;
}

function ReturnTo(url)
{
    window.location= url;
}

