// JavaScript Document


function show_loc(loc_map)//dispaly location map in separate window
{
	window.open(loc_map);	
}

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=650,height=350,left = 187,top = 209');");
}

  throwAlt = function(altMsg,type){//create window for display alt message  
	var name='Alertwindow'+type;
	var title='www.nadia-me.com';
	var url='candidate/window_alert.cfm?alt_msg='+altMsg+'&alt_type='+type;
	var config = new Object();
	config.height=115;
	config.width=400;
	config.center=true;
	config.modal=false;
	config.resizable=false;
	config.draggable=false;
	config.refreshonshow=true;
	config.headerstyle='background-color:#66CCFF';
	ColdFusion.Window.create(name,title,url,config);
  }
  
  closeAltWin = function(type){
	 //Close the alert window
	 ColdFusion.Window.hide('Alertwindow'+type);
  }

  throwConfirm = function(type){//create window for display alt message  
	var name='Confirmwindow'+type;
	var title='www.nadia-me.com: Alert';
	var url='window_confirm.cfm?conf_type='+type;
	var config = new Object();
	config.height=130;
	config.width=400;
	config.center=true;
	config.modal=false;
	config.resizable=false;
	config.draggable=false;
	config.refreshonshow=true;
	config.headerstyle='background-color:#66CCFF';
	ColdFusion.Window.create(name,title,url,config);
  }

  function closeConfWin(type){
	 //Close the confirm window
	 ColdFusion.Window.hide('Confirmwindow'+type);
  }

function OkConfWin(type){
	if(type=="lang"){
		cvedit_lang_remove();	
	}else if(type=="edu"){
		cvedit_edu_remove();
	}else if(type=="exp"){
		cvedit_exp_remove();
	}else if(type=="sem"){
		cvedit_sem_remove();
	}else if(type=="ref"){
		cvedit_ref_remove();
	}
	closeConfWin(type);	
}


function user_login(){
	var login=ColdFusion.getElementValue("cd_username");
	var psswd=ColdFusion.getElementValue("cd_password");
	//if(login == "" || login.indexOf ('@', 1) == -1 || login.indexOf ('.', 3) == -1) {
	if(login == "") {
		document.getElementById("login_display").innerHTML="Enter User Name";
	}else if(psswd==""){
		document.getElementById("login_display").innerHTML="Enter Password";
	}else{
		var d= new log_check();
		d.setCallbackHandler(mailreply);
		d.setErrorHandler(errorHandler);
		d.userpwd_check(login,psswd);
	}
	return false;
}

function mailreply(res){
	if(res=="Not"){
		document.getElementById("login_display").innerHTML = "Username and password do not match";
	}else{
		window.location.href='index.cfm';
	}
	
}

function logout(){
	rec_navigate('logout.cfm');
}

function errorHandler(statusCode,statusMsg) {
	alert(statusCode+': '+statusMsg)
}

function login_Enter(e){ //e is event object passed from function invocation
var characterCode //literal character code will be stored in this variable

	if(e && e.which){ //if which property of event object is supported (NN4)
		e = e
		characterCode = e.which //character code is contained in NN4's which property
	}else{
		e = event
		characterCode = e.keyCode //character code is contained in IE's keyCode property
	}

	if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
		user_login();
		return false 
	}else{
		return true 
	}
}
