// JavaScript Document

// Installatin notes.
//In the funtion of the AJAX replace the "http://192.168.0.4/tannet/" staging url to original url.


var MenuArr=new Array();
MenuArr[0]='';
MenuArr[1]='<a href="about.php" class="MenuLinks">About Us</a> | <a href="clients.php" class="MenuLinks">Our Major Clients</a> | <a href="article.php" class="MenuLinks">Articles</a> | <a href="events.php" class="MenuLinks">Events</a>';
MenuArr[2]='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="postresume.php" class="MenuLinks">Post Your Resume</a>';
MenuArr[3]='<a href="sectorlist.php" class="MenuLinks">Browse Jobs By Sector</a> | <a href="search.php" class="MenuLinks">Advanced Search</a>';
MenuArr[4]='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="contactcand.php" class="MenuLinks">Candidate Contact</a> | <a href="contactcorp.php" class="MenuLinks">Corporate Contact</a> ';

function showInfo(no,oleft,otop)
{
	var infoarr = new Array();
	infoarr[0]="";
	infoarr[1]="Mega Jobs are senior positions with salaries of over Rs.1Million/year";
	infoarr[2]="Enter some keywords like city name,primary skill,job post...";
	infoarr[3]="Info for the Events and Invetviews will come here";
	var	infotext=infoarr[no];
	var obj=document.getElementById('Layer1');
	obj.top=otop;
	basetext='<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td><img src="images/help.gif" align="absmiddle">	<span style="color:#990000;font-family:Verdana, Arial, Helvetica, sans-serif;font-size:15px"><b>Info</b></span> </td>	</tr><tr><td><hr></td></tr><tr><td class="MenuLinks">'+infotext+'</td></tr>	</table>';
	obj.innerHTML=basetext;
	obj.style.visibility='visible';
	obj.style.left=oleft-80;
	obj.style.top=otop + 160;	
	
}
function hideInfo()
{
	var obj=document.getElementById('Layer1');
	obj.innerHTML="";
	obj.style.visibility='hidden';
}

function swapMenuImage(imageno)
{
	HideAllMenu();
	document.getElementById('menu'+imageno).src="images/"+imageno+".jpg";	
	repopulateNavigation(imageno);
}
function HideAllMenu()
{
	for (i=0;i<4;i++)
	{
		j=i+1;
		document.getElementById('menu'+j).src="images/_"+j+".jpg";
	}
}
function repopulateNavigation(submenuno)
{
	var naviarr=new Array();
	document.getElementById("navig").innerHTML=MenuArr[submenuno];
}

function trim(inputString) {
   // Removes leading and trailing spaces from the passed string. Also removes
   // consecutive spaces and replaces it with one space. If something besides
   // a string is passed in (null, custom object, etc.) then return the input.
   if (typeof inputString != "string") { return inputString; }
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") { // Check for spaces at the beginning of the string
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") { // Check for spaces at the end of the string
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf(" ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
      retValue = retValue.substring(0, retValue.indexOf(" ")) + retValue.substring(retValue.indexOf(" ")+1, retValue.length); // Again, there are two spaces in each of the strings
   }
   return retValue; // Return the trimmed string back to the user
} // Ends the "trim" function
function msg(msg)
{
	prffx="Please, ";
	suffx=" , Thank You";
	alert(prffx + msg + suffx);
}
function emailcheck(email,msg) 	                                        
{                                                                       
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))
	{               
		return false;                                           
	}                                                               
	else
	{
		alert(msg);
		return true;                                                    
	}
}

function isFloat(s) 
{
		if(!s.match(/^\d{0,10}[.]{0,1}\d{0,2}$/))
			return false;
		else
			return true ;
}

function isNumber(s) 
{
	if(s.match(/^\d{0,10}$/) && s <= 2147483647)
		return true;		
	else
		return false ;
}

//Ajax Functions

function getUrl(strURL,targetObj)
{
	if (strURL.length > 0)
	{
		OpenURL(strURL,targetObj);
	}
}
function OpenURL(strURL,targetObj)
{
	
  var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
      		targetObj.innerHTML=xmlHttp.responseText;	
        }
      }
	  xmlHttp.open("GET",strURL,true);
	  xmlHttp.send("none");	  
}