/****************************************************************\
 *  This file Coded by : Al-Mothafar M. Al-Hasan
 *  http://www.almothafar.com
 *  Copyrighted for Digital Series Company - Jordan
 *  Copyrighted for Total Technology Solutions (Hulool) - KSA
 *  http://www.digital-series.com & http://www.hulool.com
 *  2010 (c)
 \***************************************************************/

function gotoPage(x)
{
    if (x != 'undefined' && x.toString() != "")
        window.location=x.toString();
}

function showLogin(id,show)
{
    var prop = "none";
    if (show.toString() == "true")
        prop = "inline";
    //var temp = document.getElementById(id).innerHTML;
    /*if (temp.toString().indexOf("You are signed in") != -1)
            return;*/

    var tempStr = window.location.href; // this to check if I'm in maximized mode (just login box showed in page)'
    if (tempStr.toString().indexOf("struts_action=%2Flogin") == -1 || tempStr.toString().indexOf("p_p_state=maximized") == -1)
        document.getElementById(id).style.display = prop;
}

function reduceText(str,max_characters)
{
    var strValue = str.toString();
    if (strValue.toString().length > max_characters)
        strValue = strValue.toString().substr(0, max_characters);
    //alert(strValue.toString());
    document.write(strValue);
}

function getCookie(c_name)
{
    if (document.cookie.length>0)
    {
        c_start=document.cookie.indexOf(c_name + "=");
        if (c_start!=-1)
        {
            c_start=c_start + c_name.length+1;
            c_end=document.cookie.indexOf(";",c_start);
            if (c_end==-1) c_end=document.cookie.length;
            return unescape(document.cookie.substring(c_start,c_end));
        }
    }
    return "";
}

var intervalT = null;
var counter = 0;
function showChildren()
{
    clearInterval(intervalT);
    counter = 0;
//    document.getElementById("MySettings_Children").setAttribute("class", "hide_MySettings_Children");
    document.getElementById("MySettings_Children").className = "hide_MySettings_Children";
//    document.getElementById("myBU_Children").setAttribute("class", "show_MyBU_Children");
    document.getElementById("myBU_Children").className = "show_MyBU_Children";
}


function hideChildren()
{
    clearInterval(intervalT);
    intervalT = setInterval(hideChildren, 5000);
    if (counter == 0 )
    {
        counter++;
        return;
    }
//    document.getElementById("myBU_Children").setAttribute("class", "hide_MyBU_Children");
    document.getElementById("myBU_Children").className = "hide_MyBU_Children";
}



var intervalT1 = null;
var counter1 = 0;
function showChildrenSettings()
{
    clearInterval(intervalT1);
    counter1 = 0;
//    document.getElementById("MySettings_Children").setAttribute("class", "show_MySettings_Children");
    document.getElementById("MySettings_Children").className = "show_MySettings_Children";
//    document.getElementById("myBU_Children").setAttribute("class", "hide_MyBU_Children");
    document.getElementById("myBU_Children").className = "hide_MyBU_Children";
}

function hideChildrenSettings()
{
    clearInterval(intervalT1);
    intervalT1 = setInterval(hideChildrenSettings, 5000);
    if (counter1 == 0 )
    {
        counter1++;
        return;
    }
//    document.getElementById("MySettings_Children").setAttribute("class", "hide_MySettings_Children");
    document.getElementById("MySettings_Children").className = "hide_MySettings_Children";
}
