function getHTTPObject() {
  var xmlhttp;

  if(window.XMLHttpRequest){
    xmlhttp = new XMLHttpRequest();
  }
  else if (window.ActiveXObject){
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    if (!xmlhttp){
        xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
    }

}
  return xmlhttp;
}

var http = getHTTPObject(); // We create the HTTP Object

function searchresult(){
	
	var kword=document.getElementById("textfield").value;

	var regExp = /^([a-zA-Z0-9]([ -])?)*$/;

	if(regExp.test(kword)==true){	 
	
	var dropdown=document.getElementById('select').options[document.getElementById('select').selectedIndex].text;

	if(kword!="Keyword"){
		window.location.href="keyword-search.php?kword="+kword+"&type="+dropdown;
	}
	else
		alert("Please enter a keyword to search.");
}
	else{
		alert("Please enter a valid keyword to search.");
		}
	}

function browseresult(){
	
	var kword=document.getElementById("textfield").value;

	var regExp = /^([a-zA-Z0-9]([ -])?)*$/;

	if(regExp.test(kword)==true){	 
	
	var dropdown=document.getElementById('select').options[document.getElementById('select').selectedIndex].text;
//alert(kword+dropdown);
	if(kword!="Keyword"){
	//	alert("kwd");
		window.location.href="keyword-search.php?kword="+kword+"&type="+dropdown;
	}
	else
		alert("Please enter a keyword to search.");
	}
	else{
		alert("Please enter a valid keyword to search.");
		}
	}

	function browseresult2(){
	
	var kword=document.getElementById("textfield").value;

	var regExp = /^([a-zA-Z0-9]([ -])?)*$/;

	if(regExp.test(kword)==true){	 
	
	var dropdown=document.getElementById('select').options[document.getElementById('select').selectedIndex].text;
//alert(kword+dropdown);
	if(kword!="Keyword"){
	//	alert("kwd");
		window.location.href="../keyword-search.php?kword="+kword+"&type="+dropdown;
	}
	else
		alert("Please enter a keyword to search.");
	}
	else{
		alert("Please enter a valid keyword to search.");
		}
	}


function clearkeydata(){
	if(document.getElementById("textfield").value=="Keyword")
		document.getElementById("textfield").value="";
}
function fillkeydata(){
	if(document.getElementById("textfield").value=="")	
		document.getElementById("textfield").value="Keyword";
}

function cleartext(){
	if(document.getElementById("userid").value==""){
		document.getElementById("userid").value="";
	}
}
function cleardata(){
	if(document.getElementById("password").value=="")
		document.getElementById("password").value="";
}
function filldata(){
	if(document.getElementById("password").value=="")	
		document.getElementById("password").value="";
}
function filltext(){
	if(document.getElementById("userid").value=="")	
		document.getElementById("userid").value="";
}

function cookiecheck(val){
	if(val=="sign"){
window.location.href="../sign-in.php";

	}
	else{
window.location.href="sign-in.php";
	}
}

function displaydrop(){
if(document.getElementById('drophere').innerHTML!=""){
document.getElementById('drophere').innerHTML="";
}
else{
document.getElementById('drophere').innerHTML="<table width='30%' class='tableborder' cellpadding='1' cellspacing='1' align='right' bordercolor='#DDDDDD'><tr><td align='left'><a href='my-jobs.php' class='linkblue'>My Jobs</a></td></tr><tr><td align='left'><a href='job-post-profile.php' class='linkblue'>Post Resume</a></td></tr><tr><td align='left'><a href='job-search.php' class='linkblue'>Search Jobs</a></td></tr></table>";
}
}


function getKey(myfield,event)
	{
		//alert(DHTML_modalMessage);
		if(messageObj.url!=""){
		if(event.keyCode == 27){ // Capture Esc key-press to quit in between
        messageObj.close();	
		}
		}
	}

function enterkey(myfield,event,log1){
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (event) keycode = event.which;
else return true;

if (keycode == 13)
{
	if(log1=="0"){
		browseresult();
	}
	else if(log1=="2"){
		browseresult2();
	}
	else {
		searchresult();
	}
}
}

function textCounter(field,maxChars,minChars,spanName)
 {
	 var txtArea = document.getElementById(field);

 if (txtArea.value.length < minChars+1)
  {
   
   document.getElementById(spanName).innerHTML = (minChars-(maxChars + txtArea.value.length));
}
else
	 {
 alert ("You have reached maximum number of characters..");
 var inp = document.getElementById(field).value;
 inp = inp.substr(maxChars,minChars);
 document.getElementById(field).value = inp;
 return ;
}
 }
 function getonlinemeet(){
	 //alert("hi");
	var currentDt = new Date().getTime();
	 if (http.readyState != 4 && http.readyState!=0){ 
		return;
		}
	else{
	http.open("GET","timezones.php?token="+escape(currentDt),true);
	http.onreadystatechange = handleonlinemeet;
	http.send(null);
	}
}

function handleonlinemeet() 
{	
     if (http.readyState == 4) 
		 {
                var results=http.responseText;
				var res=results.split("@");
				if(res[0]!="no")
					{
					openchat(res[0]);
					 }
		}
 }

function openchat(val111){
		if(val111=="yes")
				  {
window.open("anitha.php",'onlinemeeting','height=525, width=300, left=0, top=0, toolbar=no, menubar=no, directories=no, location=no, scrollbars=no, status=no, resizable=yes, fullscreen=no');
				  }
}

function setlefttop(){
var topOffset = Math.max(document.body.scrollTop,document.documentElement.scrollTop);

var left=document.getElementById("loading_message_join").style.left;
var top=document.getElementById("loading_message_join").style.top;

var w = document.documentElement.clientWidth;
var h = document.documentElement.clientHeight;
    	
		if (self.innerHeight){ // all except Explorer 		 
		   w = self.innerWidth; 
		   h = self.innerHeight; 
		}  else if (document.documentElement && document.documentElement.clientHeight) {
		   // Explorer 6 Strict Mode 	
		   w = document.documentElement.clientWidth; 
		   h = document.documentElement.clientHeight; 
		} else if (document.body) {// other Explorers 		
		   w = document.body.clientWidth; 
		   h = document.body.clientHeight; 
		} 

var tmpWidth = document.getElementById("loading_message_join").offsetWidth;	
var tmpHeight = document.getElementById("loading_message_join").offsetHeight;

if((tmpWidth=="0") && (tmpHeight=="0")){
tmpWidth="104";
tmpHeight="85";
}

document.getElementById("loading_message_join").style.left = Math.ceil((w - tmpWidth) / 2) + 'px';
document.getElementById("loading_message_join").style.top = (Math.ceil((h - tmpHeight) / 2) +  topOffset) + 'px';
}

function showdefaultgif(){
setlefttop();
var gifval=document.getElementById("gifval").value;
if(gifval!="0"){
document.getElementById("loading_message_join").style.display = 'block';
}
else{
document.getElementById("loading_message_join").style.display = 'none';
}
}

var new_win=null;
function gotowindow(url){
new_win = window.open(url,"new_win",'height=325, width=550, left=0, top=0, toolbar=no, menubar=no, directories=no, location=no, scrollbars=yes, status=no, resizable=yes, fullscreen=no');
var timeval=new Date().getTime();

}


function testuser(str)
{
	var user = document.getElementById("userid").value;
	var pwd = document.getElementById("pwd").value;
	http.open("GET","secure_login_user.php?user="+escape(user)+"&pwd="+escape(pwd)+"&str="+escape(str),true);
	http.onreadystatechange = handlesecuritylogin;
	http.send(null);	
}

function handlesecuritylogin()
{
	if (http.readyState == 4) 
		 {
                var response=http.responseText;
				//alert(response);
				var res = response.split("@");
				
				var str = document.getElementById("str").value;
				
				if(res[0]==1)
				{
					window.location.href="privacy-settings.php?"+res[1];
				}
				else
				{
					var timeval = new Date().getTime();
					var url="provide_security.php";					
					var url2="?str="+str+"&msg="+res[1];
					url=url+url2;					
					messageObj.setSize(320,200);
					messageObj.setSource(url);
					messageObj.setCssClassMessageBox(false);
					messageObj.setShadowDivVisible(true);	// Enable shadow for these boxes
					messageObj.display();					
				}
		 }
	
}

function getKey2(myfield,event,str)
	{
		if(event.keyCode == 13){ // Capture Esc key-press to quit in between
        testuser(str);
		}		
	}
	
	// dropdown  javascript
	
	//** Chrome Drop Down Menu- Author: Dynamic Drive (http://www.dynamicdrive.com)

//** Updated: July 14th 06' to v2.0
	//1) Ability to "left", "center", or "right" align the menu items easily, just by modifying the CSS property "text-align".
	//2) Added an optional "swipe down" transitional effect for revealing the drop down menus.
	//3) Support for multiple Chrome menus on the same page.

//** Updated: Nov 14th 06' to v2.01- added iframe shim technique

//** Updated: July 23rd, 08 to v2.4
	//1) Main menu items now remain "selected" (CSS class "selected" applied) when user moves mouse into corresponding drop down menu. 
	//2) Adds ability to specify arbitrary HTML that gets added to the end of each menu item that carries a drop down menu (ie: a down arrow image).
	//3) All event handlers added to the menu are now unobstrusive, allowing you to define your own "onmouseover" or "onclick" events on the menu items.
	//4) Fixed elusive JS error in FF that sometimes occurs when mouse quickly moves between main menu items and drop down menus


var cssdropdown={
disappeardelay: 250, //set delay in miliseconds before menu disappears onmouseout
dropdownindicator: '<img src="images/s.gif" border="0" />', //specify full HTML to add to end of each menu item with a drop down menu
enableswipe: 1, //enable swipe effect? 1 for yes, 0 for no
enableiframeshim: 1, //enable "iframe shim" in IE5.5/IE6? (1=yes, 0=no)

//No need to edit beyond here////////////////////////

dropmenuobj: null, asscmenuitem: null, domsupport: document.all || document.getElementById, standardbody: null, iframeshimadded: false, swipetimer: undefined, bottomclip:0,

getposOffset:function(what, offsettype){
	var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
	var parentEl=what.offsetParent;
	while (parentEl!=null){
		totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl=parentEl.offsetParent;
	}
	return totaloffset;
},

swipeeffect:function(){
	if (this.bottomclip<parseInt(this.dropmenuobj.offsetHeight)){
		this.bottomclip+=10+(this.bottomclip/10) //unclip drop down menu visibility gradually
		this.dropmenuobj.style.clip="rect(0 auto "+this.bottomclip+"px 0)"
	}
	else
		return
	this.swipetimer=setTimeout("cssdropdown.swipeeffect()", 10)
},

css:function(el, targetclass, action){
	var needle=new RegExp("(^|\\s+)"+targetclass+"($|\\s+)", "ig")
	if (action=="check")
		return needle.test(el.className)
	else if (action=="remove")
		el.className=el.className.replace(needle, "")
	else if (action=="add" && !needle.test(el.className))
		el.className+=" "+targetclass
},

showhide:function(obj, e){
	this.dropmenuobj.style.left=this.dropmenuobj.style.top="-500px"
	if (this.enableswipe==1){
		if (typeof this.swipetimer!="undefined")
			clearTimeout(this.swipetimer)
		obj.clip="rect(0 auto 0 0)" //hide menu via clipping
		this.bottomclip=0
		this.swipeeffect()
	}
	obj.visibility="visible"
	this.css(this.asscmenuitem, "selected", "add")
},

clearbrowseredge:function(obj, whichedge){
	var edgeoffset=0
	if (whichedge=="rightedge"){
		var windowedge=document.all && !window.opera? this.standardbody.scrollLeft+this.standardbody.clientWidth-15 : window.pageXOffset+window.innerWidth-15
		this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetWidth
		if (windowedge-this.dropmenuobj.x < this.dropmenuobj.contentmeasure)  //move menu to the left?
			edgeoffset=this.dropmenuobj.contentmeasure-obj.offsetWidth
	}
	else{
		var topedge=document.all && !window.opera? this.standardbody.scrollTop : window.pageYOffset
		var windowedge=document.all && !window.opera? this.standardbody.scrollTop+this.standardbody.clientHeight-15 : window.pageYOffset+window.innerHeight-18
		this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetHeight
		if (windowedge-this.dropmenuobj.y < this.dropmenuobj.contentmeasure){ //move up?
			edgeoffset=this.dropmenuobj.contentmeasure+obj.offsetHeight
			if ((this.dropmenuobj.y-topedge)<this.dropmenuobj.contentmeasure) //up no good either?
				edgeoffset=this.dropmenuobj.y+obj.offsetHeight-topedge
		}
	}
	return edgeoffset
},

dropit:function(obj, e, dropmenuID){
	if (this.dropmenuobj!=null) //hide previous menu
		this.hidemenu() //hide menu
	this.clearhidemenu()
	this.dropmenuobj=document.getElementById(dropmenuID) //reference drop down menu
	this.asscmenuitem=obj //reference associated menu item
	this.showhide(this.dropmenuobj.style, e)
	this.dropmenuobj.x=this.getposOffset(obj, "left")
	this.dropmenuobj.y=this.getposOffset(obj, "top")
	this.dropmenuobj.style.left=this.dropmenuobj.x-this.clearbrowseredge(obj, "rightedge")+"px"
	this.dropmenuobj.style.top=this.dropmenuobj.y-this.clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+1+"px"
	this.positionshim() //call iframe shim function
},

positionshim:function(){ //display iframe shim function
	if (this.enableiframeshim && typeof this.shimobject!="undefined"){
		if (this.dropmenuobj.style.visibility=="visible"){
			this.shimobject.style.width=this.dropmenuobj.offsetWidth+"px"
			this.shimobject.style.height=this.dropmenuobj.offsetHeight+"px"
			this.shimobject.style.left=this.dropmenuobj.style.left
			this.shimobject.style.top=this.dropmenuobj.style.top
		}
	this.shimobject.style.display=(this.dropmenuobj.style.visibility=="visible")? "block" : "none"
	}
},

hideshim:function(){
	if (this.enableiframeshim && typeof this.shimobject!="undefined")
		this.shimobject.style.display='none'
},

isContained:function(m, e){
	var e=window.event || e
	var c=e.relatedTarget || ((e.type=="mouseover")? e.fromElement : e.toElement)
	while (c && c!=m)try {c=c.parentNode} catch(e){c=m}
	if (c==m)
		return true
	else
		return false
},

dynamichide:function(m, e){
	if (!this.isContained(m, e)){
		this.delayhidemenu()
	}
},

delayhidemenu:function(){
	this.delayhide=setTimeout("cssdropdown.hidemenu()", this.disappeardelay) //hide menu
},

hidemenu:function(){
	this.css(this.asscmenuitem, "selected", "remove")
	this.dropmenuobj.style.visibility='hidden'
	this.dropmenuobj.style.left=this.dropmenuobj.style.top=0
	this.hideshim()
},

clearhidemenu:function(){
	if (this.delayhide!="undefined")
		clearTimeout(this.delayhide)
},

addEvent:function(target, functionref, tasktype){
	if (target.addEventListener)
		target.addEventListener(tasktype, functionref, false);
	else if (target.attachEvent)
		target.attachEvent('on'+tasktype, function(){return functionref.call(target, window.event)});
},

startchrome:function(){
	if (!this.domsupport)
		return
	this.standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
		//alert(arguments);
	
	for (var ids=0; ids<arguments.length; ids++){
		/*alert(arguments[ids]);
		alert(document.getElementById(arguments[0]));
		alert(document.getElementById(arguments[ids]));*/
		var menuitems=document.getElementById(arguments[ids]).getElementsByTagName("a");
		for (var i=0; i<menuitems.length; i++){
			if (menuitems[i].getAttribute("rel")){
				var relvalue=menuitems[i].getAttribute("rel")
				var asscdropdownmenu=document.getElementById(relvalue)
				this.addEvent(asscdropdownmenu, function(){cssdropdown.clearhidemenu()}, "mouseover")
				this.addEvent(asscdropdownmenu, function(e){cssdropdown.dynamichide(this, e)}, "mouseout")
				this.addEvent(asscdropdownmenu, function(){cssdropdown.delayhidemenu()}, "click")
				try{
					menuitems[i].innerHTML=menuitems[i].innerHTML+" "+this.dropdownindicator
				}catch(e){}
				this.addEvent(menuitems[i], function(e){ //show drop down menu when main menu items are mouse over-ed
					if (!cssdropdown.isContained(this, e)){
						var evtobj=window.event || e
						cssdropdown.dropit(this, evtobj, this.getAttribute("rel"))
					}
				}, "mouseover")
				this.addEvent(menuitems[i], function(e){cssdropdown.dynamichide(this, e)}, "mouseout") //hide drop down menu when main menu items are mouse out
				this.addEvent(menuitems[i], function(){cssdropdown.delayhidemenu()}, "click") //hide drop down menu when main menu items are clicked on
			}
		} //end inner for
	} //end outer for
	if (window.createPopup && !window.XmlHttpRequest &&!this.iframeshimadded){ //if IE5.5 to IE6, create iframe for iframe shim technique
		document.write('<IFRAME id="iframeshim"  src="" style="display: none; left: 0; top: 0; z-index: 90; position: absolute; filter: progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)" frameBorder="0" scrolling="no"></IFRAME>')
		this.shimobject=document.getElementById("iframeshim") //reference iframe object
		this.iframeshimadded=true
	}
} //end startchrome

}
	
	// end of dropdown javascript

function getsubmit(){
	document.getElementById('subval').value="1";
	document.myForm.submit();
}

function refresh_im(){
//setInterval(refresh_im,30000);
//document.getElementById('divframe').innerHTML='<iframe align="top" height="0" width="0" src="http://www.globallinker.com/php121im.php" style="visibility:hidden;"></iframe>';
}


