/*-----------------------------------------------------------
    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(num,numelems,opennum,animate)
{
    if ($('tabContent'+num).style.display == 'none')
    {
        for (var i=1;i<=numelems;i++)
        {
            if ((opennum == null) || (opennum != i))
            {
                var temph = 'tabHeader'+i;
                var h = $(temph);
                if (!h)
                {
                    var h = $('tabHeaderActive');
                    h.id = temph;
                }
                var tempc = '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 = $('tabHeader'+num);
        if (h)
            h.id = 'tabHeaderActive';
        h.blur();
        var c = $('tabContent'+num);
        c.style.marginTop = '2px';
        if (animate || typeof animate == 'undefined')
        {
            Effect.toggle('tabContent'+num,'blind',{duration:0.5, queue:{scope:'menus', position:'end', limit: 3}});
        }
        else
        {
            toggleDisp('tabContent'+num);
        }
    }
}

function writeFlash(id, file, width, height)
{
  document.getElementById(id).innerHTML = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='"+width+"' height='"+height+"' id='myflash' align='middle'><param name='allowScriptAccess' value='sameDomain' /><param name='movie' value='/uploads/"+file+"' /><param name='quality' value='high' /><param name='bgcolor' value='#ffffff' /><embed src='/uploads/"+file+"' quality='high' bgcolor='#ffffff' width='"+width+"' height='"+height+"' name='mymovie' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object>";
}

function checkUsername(key)
{
  if(document.getElementById('username').value == key)
  {
    document.getElementById('username').value = ''
  }

}
function checkUsernameOut(key)
{
  if(document.getElementById('username').value == '')
  {
    document.getElementById('username').value = key
  }
}
function checkPassword()
{
  if(document.getElementById('password').value == 'password')
  {
    document.getElementById('password').value = ''
  }
}
function checkPasswordOut()
{
  if(document.getElementById('password').value == '')
  {
    document.getElementById('password').value = 'password'
  }
}
function getInputColor(){
    var wColor;
    if (document.getElementById('jsNotificationEnabled').value == 'on') {
	wColor = "#000000";
    }
    else {
    	wColor = "#C2C2C2";
    }
    return wColor;
}
function checkEmail(key)
{
  if(document.getElementById('jsNotificationEmail').value == key)
  {
    document.getElementById('jsNotificationEmail').value = '';
    var whatColor = getInputColor();

    document.getElementById('jsNotificationEmail').style.color = whatColor;
  }
}
function checkEmailOut(key)
{
  if(document.getElementById('jsNotificationEmail').value == '')
  {
    document.getElementById('jsNotificationEmail').value = key;

    var whatColor = getInputColor();
    document.getElementById('jsNotificationEmail').style.color = whatColor;
  }
}
function checkMobile(key)
{
  if(document.getElementById('jsNotificationMobile').value == key)
  {
    document.getElementById('jsNotificationMobile').value = '';
    var whatColor = getInputColor();
    document.getElementById('jsNotificationMobile').style.color = whatColor;
  }
}
function checkMobileOut(key)
{
  if(document.getElementById('jsNotificationMobile').value == '')
  {
    document.getElementById('jsNotificationMobile').value = key;

    var whatColor = getInputColor();
    document.getElementById('jsNotificationMobile').style.color = whatColor;
  }
}
function loading()
{
  document.getElementById('Loading').style.display = 'block';
  Effect.Pulsate('Loading');
}
function openPanel(id)
{
  for(i = 0; i < 5; i++)
  {
    if(i == id)
    {
      document.getElementById('popup' + i).style.display = 'block';
    }
    else
    {
      document.getElementById('popup' + i).style.display = 'none';
    }
  }
}

function checkInput(id, value)
{
  if($(id).value == value)
  {
    $(id).value = ''
  }

}

function checkInputOut(id, value)
{
  if($(id).value == '')
  {
    $(id).value = value;
  }
}