/*-----------------------------------------------------------
 *     Toggles element's display value
 *         Input: any number of element id's
 *             Output: none 
 *                 ---------------------------------------------------------*/
function toggleDisp() {
    for (var i=0;i<arguments.length;i++){
        var d = $(arguments[i]);
        if (d.style.display == 'none')
            d.style.display = 'block';
        else
            d.style.display = 'none';
    }
}
/*-----------------------------------------------------------
 *     Toggles tabs - Closes any open tabs, and then opens current tab
 *         Input:     1.The number of the current tab
 *                             2.The number of tabs
 *                                                 3.(optional)The number of the tab to leave open
 *                                                                     4.(optional)Pass in true or false whether or not to animate the open/close of the tabs
 *                                                                         Output: none 
 *                                                                             ---------------------------------------------------------*/
function toggleTab(prefix,num,numelems,opennum,animate) {
    if ($(prefix+'tabContent'+num).style.display == 'none'){
        for (var i=1;i<=numelems;i++){
            if ((opennum == null) || (opennum != i)){
                var temph = prefix+'tabHeader'+i;
                var h = $(temph);
                if (!h){
                    var h = $(prefix+'active');
                    h.id = temph;
                }
                var tempc = prefix+'tabContent'+i;
                var c = $(tempc);
                if(c.style.display != 'none'){
                    if (animate || typeof animate == 'undefined')
                        Effect.toggle(tempc,'blind',{duration:0.5, queue:{scope:'menus', limit: 3}});
                    else
                        toggleDisp(tempc);
                }
            }
        }
        var h = $(prefix+'tabHeader'+num);
        if (h)
            h.id = prefix+'active';
        h.blur();
        var c = $(prefix+'tabContent'+num);
        c.style.marginTop = '2px';
        if (animate || typeof animate == 'undefined'){
            Effect.toggle(prefix+'tabContent'+num,'blind',{duration:0.5, queue:{scope:'menus', position:'end', limit: 3}});
        }else{
            toggleDisp(prefix+'tabContent'+num);
        }
    }
}

// Popup Display Function
function PopUp(url)
{
	day = new Date();
	id = day.getTime();
	//window.open(url, 'Intranet : Popup', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=500,height=500,left = 362,top = 134');
	window.open(url);
}

function WindowPopup(url, width, height)
{
	window.open(url);
	//window.open(url, 'User Properties', 'width=' + width + ',height=' + height + 'toolbar=no,location=no,directories=no,scrollbars=yes');
}

function SetCookie(cookieName,cookieValue,nDays) {
 var today = new Date();
 var expire = new Date();
 if (nDays==null || nDays==0) nDays=1;
 expire.setTime(today.getTime() + 3600000*24*nDays);
 document.cookie = cookieName+"="+escape(cookieValue)
                 + ";expires="+expire.toGMTString();
}
function BackToEnglish()
{
        del_cookie('translate');
        location.reload(true);
}
function del_cookie(name) {
document.cookie = name +
'=; expires=Thu, 01-Jan-70 00:00:01 GMT;';
}
function conLoad(url)
{
	$("#int_content").html("<table width='100%' height='500'><tr><td align='center' valign='center' class='light_text'><img src='" + ContentURL + "resources/ajax/fb.gif' /><br />Loading... Please Wait...</td></tr></table>");
	$.get(url, {}, function(data) { $("#int_content").html(data); });
}
