window.onload=jQuery(document).ready(function(){
	jQuery('img').error(function(){ jQuery(this).hide(); });
	if (jQuery('#divSignCreate')) jQuery('#divSignCreate').show();
	if (jQuery('#dddd')) jQuery('#dddd').css("width", "50%");
});
var gAS = 'pub-5824148512720125';

function loadFB(s, u)
{
	if (typeof(s)=='undefined' || s != 'emp')
		jQuery.noConflict();
    jQuery(document).ready(function($) {
      jQuery('a[rel*=facebox]').facebox({
        loadingImage : u+'j/facebox/loading.gif',
        closeImage   : u+'j/facebox/closelabel.gif'
      }) 
    })
}
	
var popUpWin=pwmkm=0;
function puWin(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
	  if (!popUpWin.closed)
	    popUpWin.close();
  }  
 popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top);
  
}

function $F(id){
	return jQuery('#'+id).val();
}
function $R(id){
	 var tmp = jQuery("input[name="+id+"]:checked").val();
	 if (typeof tmp == "undefined")
	 	return '';
	 else
	 	return tmp;
}
function selOpt(oln, ListVal)
{	
	for (i=0; i < oln.length; i++)
	{
		if (oln.options[i].value == ListVal)
		{
			oln.selectedIndex = i;
			break;
		}
	}
}

function lding(dw, id, path, extra)
{
    path = (typeof path == "undefined" ? "" : path);
	extra = (typeof path == "undefined" ? "" : extra);
    switch(dw)
    {
        case '00': $(id).hide(); break;
        case '01': $(id).innerHTML = '<img src="'+path+'i/load-16w.gif" width="16" height="16" '+extra+' style="width:16px;height:16px;" />'; $(id).show();break;
    
        case '10': $(id).hide(); break;
        case '11': $(id).innerHTML = '<img src="'+path+'i/load-16g.gif" width="16" height="16" '+extra+' style="width:16px;height:16px;" />'; $(id).show();break;

		case '20': $(id).hide(); break;
        case '21': $(id).innerHTML = '<img src="'+path+'i/loadH.gif" width="43" height="11" '+extra+' style="width:43px;height:11px;" />'; $(id).show();break;
		
		case '30': $(id).hide(); break;
        case '31': $(id).innerHTML = '<img src="'+path+'i/loadH.gif" width="12" height="12" '+extra+' style="width:12;height:12px;" />'; $(id).show();break;
    }
}

function clearVal(obj,txt){
	if(obj.value==txt)
		obj.value = '';
	else if	(obj.value == '')
		obj.value = txt;
}


//-------------------- Forward Job Function 

function forwardMail()
{
	cur_job_id=$F('fwdJid');
	
	username=$F('username');
	userEmail=$F('userEmail');
	forwardTo=$F('forwardTo');
	vImageCodP=jQuery('#mkm_fwdJob #vImageCodP').val();
	str = $H({btnSubmit:'forwardEmail',username:username,userEmail:userEmail,forwardTo:forwardTo,cur_job_id:cur_job_id,vImageCodP:vImageCodP}).toQueryString();
	new Ajax.Request('forward-email.php', 
		{
			method: 'post', 
			parameters: str,
			onSuccess:_forwardMail,
			onLoading: lding('21','mkm_fwdJob')
		});
}

function _forwardMail(msg)
{
	var a = msg.responseText;
	$('mkm_fwdJob').update(a);
}

function changePassword()
{
	oPass=$('oPass').value;
	nPass=$('nPass').value;
	cnPass=$('cnPass').value;
	p = $H({Submit:'ChangePassword',oPass:oPass,nPass:nPass,cnPass:cnPass}).toQueryString();
	
	new Ajax.Request('change-password.php', 
		{
			method: 'post', 
			parameters: p,
			onSuccess:_changePassword,
			onLoading: lding('21','mkm_divContent')
		});
}
function _changePassword(msg)
{
	var a = msg.responseText;

	$('mkm_divContent').update(a);
}

function replaceAllChar( str, replacements ) 
{
    for ( i = 0; i < replacements.length; i++ ) {
        var idx = str.indexOf( replacements[i][0] );

        while ( idx > -1 ) {
            str = str.replace( replacements[i][0], replacements[i][1] );
            idx = str.indexOf( replacements[i][0] );
        }

    }

    return str;
}

function showHide(show,hide){

	show = show.split('#');
	hide = hide.split('#');
	
	if(hide!='null'){
		for(i=0; i<hide.length; i++){
			if($(hide[i]))
				$(hide[i]).style.display = 'none';
			//else
				//alert('Unable to hide: '+hide[i]);
		}
	}

	if(show!='null'){
		for(i=0; i<show.length; i++){
			if($(show[i]))
				$(show[i]).style.display = '';
			//else
				//alert('Unable to show: '+show[i]);
		}
	}
}

function resetFieldF(obj,currentVal,valToCheck,valToSet)
{
	if( currentVal == valToCheck )
	obj.value=valToSet;
}
function resetFieldB(obj,currentVal,valToSet)
{
	if( currentVal == '' )
	obj.value=valToSet;
}

var _ajx = function(u, d, c, id, i, dt, pm)
{
	dt = (typeof(dt) == "undefined" ? "string" : dt);	// return type
	pm = (typeof(pm) == "undefined" ? "post" : pm);	// posting method

	if(typeof(id)!='undefined' && id != '')
	{
		i = (typeof(i) == "undefined" ? "1" : i);
		switch(i)
		{
			case "1": i='i/load-16g.gif'; break;
			case "2": i='i/ldr-big.gif'; break;
			case "3": i='i/ldr-arr.gif'; break;
			default: i='i/load-16g.gif'; break;
		}
		var ldImg = jQuery('<img/>').attr({'src': i,'alt': 'Wait ... '});

		jQuery('#' + id).ajaxStart(function(){
		    jQuery(this).append(ldImg);
			jQuery(this).show();
		});
		jQuery('#' + id).ajaxStop(function(){
			ldImg.remove();
			jQuery(this).hide();
			jQuery(this).unbind();
		});
	}

	jQuery.ajax({url:u, type:pm, data:d, dataType:dt, success:c});
}


function errMessage(errMessage)
{

	if (errMessage != '')
	return '<div id="msgi"><div class="msgbge"><ul><li class="sp18"><img src="'+seekURL+'i/ico/ico_warn.gif" /></li><li class="msgtxti">'+errMessage+'</li></ul></div></div>';
	return false;
}

function sucMessage(message)
{
	return '<div id="msgi"><div class="msgbgs"><ul><li class="sp18"><img src="'+seekURL+'i/ico/yestick_btn.gif" /></li><li class="msgtxti" >'+message+'</li></ul></div></div>';
}


function reloadBlock(f)
{
	//$.ajax(file,'',_reloadBlock);	
	$.ajax({url:f, success:function(data){
		  updateVal('show_table',data);
		 }
	});
}

function shID(id,style)
{

	if (style=='none')
			jQuery('#'+id).hide();
		else
			jQuery('#'+id).show();
}
function getValue(id)
{
	return jQuery('#'+id).val();
}

function showMsg(id,msg,t)
{
	if(typeof(t) == 'undefined') t=5000;
	
	shID(id,'');
	jQuery('#'+id).append(msg);
	jQuery('#'+id).fadeOut(t,function(){jQuery('#'+id).html('');});
}

function fsClose()
{
	jQuery(document).trigger('close.facebox');
}

function updateVal(id,val)
{
	jQuery('#'+id).html(val);	
	
}

function insertVal(id,v)
{
	jQuery('#'+id).val(v);	
}

function toggleID(id)
{
	jQuery('#'+id).toggle();
}

function isCh(id)
{
	return jQuery('#'+id).attr('checked');
	
}
function setClass(id,cls)
{
	 jQuery('#'+id).attr('class',cls);
}


function getCatagory(catID,classID,status)
{
	for(i=0;i<=4;i++)
		$('#'+i).attr('class','');
	//$('img#imgProfileBar').css('width', t[9]+'%');
	$('#'+classID).attr('class','current');  
	if ($('#'+classID).attr('class')=='current')
		$.post('jx/cartAjx.php',  {f:'progCatagories',catID:catID}, _getCatagory);
}

function _fb(url, klass)
{
	if(typeof(klass)!='undefined')
	{
		jQuery(document).ready(function(){jQuery.facebox({ajax: url},klass); } );
	}
	else
	jQuery(document).ready(function(){jQuery.facebox({ajax: url})} );
}

function _S(id)
{
	jQuery('#'+id).show();
}

function _H(id)
{
	jQuery('#'+id).hide();
}

function getSV(obj)
{	// Get Single value of Radio Button or Checkbox
	if (!obj)
		return "RozeeError";
	for(var i=0;i<obj.length;i++){
		if (obj[i].checked){
			return(obj[i].value);
			break;
		}
	}
}

function gpt(val)
{	// Google PageView Track
	if(siteAt != 'Sailfish')
		pageTracker._trackPageview(val);
}
function get(c,a,l,v)
{	// Google Event Track
	// c=category, a=action, l=label, v=value
	if(siteAt != 'Sailfish')
		pageTracker._trackEvent(c,a,l,v);
}

function textKey(t,element,maxlength){
	supportsKeys = true;
	calcCharLeft(t,element,maxlength);
}

function getCookie(name) {
    var sPos = document.cookie.indexOf(name + "=");
    var len = sPos + name.length + 1;
    if((!sPos) && (name != document.cookie.substring(0, name.length))){
        return null;
    }
    if(sPos == -1){
        return null;
    }
    var ePos = document.cookie.indexOf(';', len);
    if(ePos == -1) ePos = document.cookie.length;
    return unescape(document.cookie.substring(len, ePos));
}

function setCookie(name, value, expires, path, domain, secure){
    var today = new Date();
    if(expires){
        expires = expires * 1000 * 3600 * 24;
    }
    document.cookie = name+'='+escape(value) +
        ((expires) ? ';expires=' + new Date(today.getTime() + expires).toGMTString() : '') +
        ((path) ? ';path=' + path : '') +
        ((domain) ? ';domain=' + domain : '') +
        ((secure) ? ';secure' : '');
}

function deleteCookie(name, path, domain){
    if(getCookie(name)){
        setCookie(name, '', -400, path, domain);
    }
} 

function calcCharLeft(t,element,maxLength){
	clipped = false;
	if (element.value.length > maxLength) { 
		element.value = element.value.substring(0,maxLength);
		charleft = 0;
		clipped = true;
	} else {
		charleft = maxLength - element.value.length;
	}
	if (t=='html')
		jQuery('#spMoreChar').html(charleft);
	else
		jQuery('#spMoreChar').val(charleft);
	return clipped;
}

function upCountry(co,lo,ciu)
{
    if(co == 'United States')
	{
	   jQuery('#expCiLo').show();	
	   jQuery('#'+ciu).hide();	  	
	}
	else
	{
		jQuery('#expCiLo').hide();
		jQuery('#'+ciu).show();	
		data = {f:'gcities', co:co};
		_ajx('inc/misc.php', data, function(x){
							jQuery('#'+ciu).html(x.msgV);
							}, lo, '1', 'json');
	}
}

function hjupCountry(co,lo,ciu,cilo)
{
    if(co == 'United States')
	{
	   jQuery('#'+cilo).show();	
	   jQuery('#'+ciu).hide();	  	
	}
	else
	{
		jQuery('#'+cilo).hide();
		jQuery('#'+ciu).show();	
		data = {f:'gcities', co:co};
		_ajx('inc/misc.php', data, function(x){
							jQuery('#'+ciu).html(x.msgV);
							}, lo, '1', 'json');
	}
}

function temo(a,b)
{	// top employer mouse over
	Tip('<b>'+a+'</b>'+b+'<br />',FADEIN, 100, PADDING, 10,BORDERSTYLE,'solid',BORDERCOLOR,'#7e7024',BGCOLOR,'#f1db39',LEFT, 'true');	
}
function teoc(a,ur,tid)
{	// top employer on click
	gpt('/topemployer/'+a);
	window.open(seekURL+ur, tid);
}

function tjmov(j)
{	// top job mouse over
	jQuery('#topJob'+j).attr('class','tJEntry tJEntryBg');
}
function tjmou(j)
{	// top job mouse out
	jQuery('#topJob'+j).attr('class','tJEntry');
}

function tjoc(ty, ur)
{	// top job on click
	if (ty == 'winloc')
		window.location= seekURL+ur;
	else
		puWin(seekURL+ur, 50,50, 800,600);
}

function pjmov(j)
{	// top job mouse over
	jQuery('#PJob'+j).attr('class','pSEntry pSEntryBg');
}
function pjmou(j)
{	// top job mouse out
	jQuery('#PJob'+j).attr('class','pSEntry');
}
function shwMsg(id,msg,tout)
{
	jQuery('#'+id).html(msg);
	jQuery('#'+id).show();
	jQuery('#'+id).fadeOut(tout);	
}
function trim(s)
{
	return rtrim(ltrim(s));
}

function ltrim(s)
{
	var l=0;
	while(l < s.length && s[l] == ' ')
	{	l++; }
	return s.substring(l, s.length);
}

function rtrim(s)
{
	var r=s.length -1;
	while(r > 0 && s[r] == ' ')
	{	r-=1;	}
	return s.substring(0, r+1);
}
function addCommas(nStr)
{
	nStr += "";
	x = nStr.split(".");
	x1 = x[0];
	x2 = x.length > 1 ? "." + x[1] : "";
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, "$1" + "," + "$2");
	}
	return x1 + x2;
}
function highchrtsToolTip()
{

	var i, temp = this.x+'<br/>', points = this.points;
	for(i=0; i<points.length; i++)
	{
		temp += '<span style="color: '+points[i].series.color+'">' + points[i].series.name + ': ' + addCommas(points[i].y) + '</span><br/>';
	};
	return temp;

}
function chkAutoFrm()
{
	var c1 = jQuery('#car1Data').val();
	var c2 = jQuery('#car2Data').val();
	var c3 = jQuery('#car3Data').val();
	
	if(c1 == "" && c2 == "" && c3 == "")
	{
		alert("Please select a car");	
		return false;
	}
	else
	return true;
/*	else if((c1 != "" && c2!= "" && c1 == c2) || (c2 != "" && c3!= "" && c2 == c3) || (c1 != "" && c3!= "" && c1 == c3))
	{
		alert("Please select different cars");	
		return false;			
	}*/
	
}

function dpWebAd(adT,frm,aID)
{
	if(frm !='topTicker')
	{
		if(adT == 'Garee')
			jQuery.facebox({div :'#adGareeDiv'});
		else if(adT == 'Bastee')
			jQuery.facebox({div :'#adBasteeDiv'});
	}
	_ajx( seekURL+'inc/misc.php', {f:'displayWebsiteAd',aID:aID,frm:frm,adT:adT}, function(r)
	{
		return true;
	}, '', '', 'json');
}

function fgmo(a,b)
{	// featured garee ad mouse over
	Tip('<b>'+a+'</b> ('+b+')',FADEIN, 100, PADDING, 10,BORDERSTYLE,'solid',BORDERCOLOR,'#4D606D',BGCOLOR,'#D0D0D0',LEFT, 'true');	
}
function tpmo(a,b,c)
{	// featured garee ad mouse over
	Tip('<b>'+a+'</b> ('+b+')<br/><i>'+c+'</i>',FADEIN, 100, PADDING, 10,BORDERSTYLE,'solid',BORDERCOLOR,'#4D606D',BGCOLOR,'#F8A300',LEFT, 'true');	
}

/*function getFbAppInfo(fbApID,uID)
{
	if(jQuery('#fbAppTp_'+uID).html()!= '')
	{
		jQuery('#fbAppTp_'+uID).show();
	}
	else
	{
			jQuery('#fbAppTp_'+uID).html(' <img src="'+seekURL+'i/working.gif" />  ');
			data = {f:'getFbAppUserInfo', fbApID:fbApID,uID:uID};
			_ajx('inc/misc.php', data, function(r){
									
									jQuery('#fbAppTp_'+r.userID).html(r.HTML);
									jQuery('#fbApTpL_'+r.userID).val('Yes');
									 
								}, '', '', 'json');
	}
}*/
function showAdById(adT,aID,city,frm)
{
	jQuery.facebox("<img src='"+seekURL+"i/loader-ring.gif' alt='loading...' />");
	_ajx( seekURL+'inc/misc.php', {f:'showAdById',aID:aID,frm:frm,adT:adT,city:city},_showAdById, '', '', 'json');	
}

function _showAdById(response)
{
	jQuery('#facebox .content').html(response['content']);
	jQuery('#facebox').css('left', (jQuery(window).width() / 2) - (jQuery('#facebox table').width() / 2));
	return true;
}

function _fbObj(i,ci)
{
	if(jQuery(i).contents().find(ci).html() != null)
	//if(jQuery(i).contents().find(ci).html() != null && jQuery(i).contents().find(ci).html() !='')
	     jQuery.facebox({ htmlContent: jQuery(i).contents().find(ci)});	
}
function sendProMsg(pid)
{
	var sendOpt = jQuery('sendopt_'+pid).val();
	var adName = jQuery('adName_'+pid).val();
	var adEmail = jQuery('adEmail_'+pid).val();
	var adCode = jQuery('adCode_'+pid).val();
	var adNumber = jQuery('adNumber_'+pid).val();
	var adMessage = jQuery('adMessage_'+pid).val();

	if(sendOpt != "sms" && sendOpt != "email")
	{
		alert("Please choose option for sending sms or email");	
		return false;
	}
	else if(adName == "")
	{
		alert("Please write your name");	
		return false;
	}
	else if(sendOpt == "email" && adEmail == "")
	{
		alert("Please write your email");	
		return false;
	}
	else if(sendOpt == "sms" && adCode == "")
	{
		alert("Please write your number code");	
		return false;
	}
	else if(sendOpt == "sms" && adNumber == "")
	{
		alert("Please write your number");	
		return false;
	}
	else if(adMessage == "")
	{
		alert("Please write your message");	
		return false;
	}
	else
	{
		_ajx( seekURL+'inc/misc.php', {f:'sendProMsg',sendOpt:sendOpt,adName:adName,adEmail:adEmail,adCode:adCode,adNumber:adNumber,adMessage:adMessage},_sendProMsg,'','','json');
	}
}
function _sendProMsg(response)
{
	
}
function uTpChange()
{	
	if($('#uType').val() == 'Seeker')
	{
		$('#seekerChat').show();
		$('#employerChat').hide();
		$('#chat').hide();
	}
	else if($('#uType').val() == 'Employer')
	{
		$('#employerChat').show();
		$('#seekerChat').hide();
		$('#chat').hide();
	}
	else
	{
		$('#seekerChat').hide();
		$('#employerChat').hide();
		$('#chat').show();
	}
}

function uSupCall(sT)
{	
	$('#spinr').show();
	$('#aBtn').hide();
	
	var uT, uN, uE, mC, uM;
	uT = $('#uType').val();
	uN = $('#uName').val();
	uE = $('#uEmail').val();
	mC = $('#mCode').val();
	uM = $('#uMobile').val();
	from = $('#src').val();
	
	if(uT == '' || uN == '' || uE == '' || mC == '' || uM == '')
	{
		$('#aBtn').show();
		$('#spinr').hide();	
		
		$('#divMsg').html(errMessage('All fields are mandatory.')).show();
		$('#msgi li').css('width','auto'); 
	}
	else
	{
		 _ajx('inc/misc.php', {f:'userSupportCall',uType:uT,uName:uN,uEmail:uE,mCode:mC,uMobile:uM,sType:sT,frm:from},_uSupCall, '', '', 'json');	
	}
		
}
function _uSupCall(r)
{	 
		
		$('#aBtn').show();
		$('#spinr').hide();	
		
		if(r.MsgType == 'ERR')
		{ 
			 $('#divMsg').html(r.msg).show();	
			 $('#msgi li').css('width','auto'); 
		}
		else if(r.uType == 'Employer' && r.sType == 'Chat')
			fsClose();	
		else
			_fb('call-chat-confirm.php?t='+r.uType+'&sT='+r.sType);
}

function adBCal(sT)
{
	var cN, cC, cM, aI, oC, sTxt, vc,adDt;
	aI = jQuery('#facebox').find('#adInfo').val();
	oC = jQuery('#facebox').find('#oCell').val();
	
	cN = jQuery('#facebox').find('#cName').val();
	cC = jQuery('#facebox').find('#cCode').val();
	cM = jQuery('#facebox').find('#cMobile').val();
	adDt = jQuery('#facebox').find('#adDet').val();
	sTxt = jQuery('#facebox').find('.prdPrv').html();
	vc = (ieversion !='6' ? jQuery('#facebox').find('#vImageCodP').val() : '');
	
	if(cN == '' || cC == '' || cM == '' || (ieversion !='6' && vc=='') )
	{
		 jQuery('#facebox').find('#cDivMsg').html(errMessage('Please fill the mandatory fields.')).show();
		 refreshAdCaptcha();
	}
	else
	{
		jQuery('#facebox').find('#ldCallSMS').show();
		jQuery('#facebox').find('#btns'+sT).hide();
		
		 _ajx('inc/misc.php', {f:'bannerAdSup', cN:cN, cC:cC, cM:cM, aI:aI, oC:oC, sT:sT, sTxt:sTxt, adDt:adDt, vc:vc, ie:ieversion },_adBCal, '', '', 'json');
	}
}
function _adBCal(r)
{
	jQuery('#facebox').find('#ldCallSMS').hide();
	jQuery('#facebox').find('#btns' + r.sType).show();
	
	if(r.MsgType == 'ERR')
	{
		jQuery('#facebox').find('#cDivMsg').html(r.msg).show();
	}
	else	
	{
		jQuery('#facebox').find('#cDivMsg').html(r.msg).show();
		jQuery('#facebox').find('#gSup').hide();
	}
	refreshAdCaptcha();
}
function refreshAdCaptcha(){
	
	if(ieversion =='6')
		return false;
	
	jQuery('#facebox').find('#vImageCodP').val('');
	jQuery('#facebox').find('#smsCptch').empty();
	return jQuery('#facebox').find('#smsCptch').each(function(){
		var rand = Math.random();
		var i = new Image();  
		i.src = seekURL + 'verify/img.php?size=5&' +rand;
		jQuery('#facebox').find('#smsCptch').append(i);
	});
}

function shwAdSuppDv(t)
{
	if(ieversion =='6')
		jQuery('#facebox').find('#captchaDv').hide();
		
	if(t=='Call')
	{
		jQuery('#facebox').find('#gSup, #btnsCall').show();
		
		jQuery('#facebox').find('#prvDvSMS, #cDivMsg, #btnsSMS').hide();
	}
	else if(t=='SMS')
	{
		jQuery('#facebox').find('#cDivMsg, #btnsCall').hide();
		jQuery('#facebox').find('#prvDvSMS, #gSup, #btnsSMS').show();
	}
	else
	{
		jQuery('#facebox').find('#gSup').hide();
	}
	refreshAdCaptcha();	
}

function fbLogin(url,perms) {
   FB.login(function(response) {
     if (response.authResponse) {
       //user is logged in, reload page
       //window.location.reload(true);
	   window.location= url;
     } else {
       // user is not logged in
	    window.location= url;
     }
   }, {scope:'email,user_work_history,user_education_history,user_location,friends_education_history,friends_work_history,friends_location,user_birthday,friends_birthday,offline_access,publish_stream'});
}


function showHideJQ(show,hide){

	show = show.split('#');
	hide = hide.split('#');
	
	if(hide!='null'){
		for(i=0; i<hide.length; i++){
			if(jQuery('#'+hide[i]))
				jQuery('#'+hide[i]).hide();			
		}
	}

	if(show!='null'){
		for(i=0; i<show.length; i++){
			if(jQuery('#'+show[i]))
				jQuery('#'+show[i]).show();			
		}
	}
}


//--------------------------------------------------------------------------------------
/* Copyright (c) 2008 Kean Loong Tan http://www.gimiti.com/kltan
 * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * Copyright notice and license must remain intact for legal use
 * jHelpertip
 * Version: 1.0 (Jun 2, 2008)
 * Requires: jQuery 1.2+
 */
(function($) {
	$.fn.jHelperTip = function(options) {
		// merge users option with default options
		var opts = $.extend({}, $.fn.jHelperTip.defaults, options);
		
		// default actions
		// create a ttC is not found
		if ($(opts.ttC).length == 0)
			$('<div id="'+opts.ttC.slice(1)+'"></div>').appendTo("body");
		
		// create a dC is not found
		if ($(opts.dC).length == 0)
			$('<div id="'+opts.dC.slice(1)+'"></div>').appendTo("body");
		
		if ($(opts.aC).length == 0)
			$('<div id="'+opts.aC.slice(1)+'"></div>').appendTo("body");

		
		// initialize our tooltip and our data container and also the close box
		$(opts.ttC).add(opts.aC).css({
			position: "absolute",
			display: "inline"
		}).hide();
		
		$(opts.dC).hide();
		
		// close the tooltip box
		var closeBox = function(){
			//tanveer
			/*if($('#img4Srch'))	{	
			 if(jQuery('#srchH') && jQuery('#srchH').val() == 'N') {
			   jQuery('#img4Srch').hide();			 
			   jQuery('#srchH').val('');
			 }
			 else
			  jQuery('#img4Srch').show();			 
			}*/
			 
			if (opts.source == "attribute")
				$(opts.aC).hide().empty();
			else
				$(opts.ttC).hide().empty();
		};
		
		$(".jHelperTipClose").bind("click", closeBox);
		$(opts.ttC).bind("mouseover",function(){
			$(opts.ttC).show();
			return false;
		});

		// the sources of getting data
		var getData = function(obj,e){
			if (opts.source == "ajax") {
				getPosition(e);
				$(opts.ttC).html('<div><img src="'+opts.loadingImg+'"/> '+opts.loadingText+'</div>').show();
				
				$.ajax({
					type: opts.type,
					url: opts.url,
					data: opts.data,
					success: function(msg){
						$(opts.ttC).html(msg);
						// reInitialize the close controller
						$(".jHelperTipClose").unbind("click", closeBox); 
						$(".jHelperTipClose").bind("click", closeBox);
					}
				});
			}
			
			else if (opts.source == "container"){
				$(opts.ttC).show().empty();
				$(opts.dC).clone(true).show().appendTo(opts.ttC);
			}
			
			if (opts.source == "attribute"){
				$(opts.aC).html($(obj).attr(opts.attrName));
			}
		};
		
		// used to position the tooltip
		var getPosition = function (e){
			var top = e.pageY+opts.topOff;
			var left = e.pageX+opts.leftOff;
			//var top = 346;//var left= 242;//if(left >450)	//left = left - 200; //alert(left); //alert(top); //alert(left); //var top = 335; //var left= 235;
			if (opts.source == "attribute"){
				$(opts.aC).css({
					top: top,
					left: left,
					opacity: opts.opacity
				}).show();
			}
			else {
				$(opts.ttC).css({
					top: top,
					left: left,
					opacity: opts.opacity
				}).show();
			}
		};
		// just close tool tip when not needed usually trigger by anything outside out tooltip target
		if (opts.trigger == "hover") {
			$(this).bind("mouseover", function(e){
				e.preventDefault();
				getData(this, e);
				return false;
			});
			$(this).bind("mousemove", function(e){
				getPosition(e);
				return false;
			});
			
			$(this).bind("mouseout", function(e){
			    if (opts.source == "attribute")
					$(opts.aC).hide().empty();
				else
					$(opts.ttC).hide().empty();
				return false;
			});
		}
		else if (opts.trigger == "click") {
			$(this).bind("click", function(e){
				getData(this, e);
				getPosition(e);
				$(document).bind("click", function(e){
					if (opts.autoClose) {
						if (opts.source == "attribute")
							$(opts.aC).hide().empty();
						else
							$(opts.ttC).hide().empty();
					}
				});
				
				return false;
			});
		}
	};
	
	$.fn.jHelperTip.defaults = {
		trigger: "click",
		topOff: 3,
		leftOff: 10,
		source: "container", /* attribute, container, ajax */
		attrName: '',
		ttC: "#jHelperTipContainer", /* tooltip Container*/
		dC: "#jHelperTipDataContainer", /* data Container */
		aC: "#jHelperTipAttrContainer", /* attr Container */
		opacity:  1.0,
		loadingImg: "ajax-loader.gif",
		loadingText: "Loading...",
		type: "GET", /* data can be inline or CSS selector */
		//url: '',
		//data: '',
		autoClose: true
	};
})(jQuery);
//--------------------------------------------------------------------------------------

function upCountryDyn(co,lo,ciu,txtCty)
{
    // co = current selected country
    // lo = image show for loading
    // ciu = city drop down 
    // txtCty = input box for city
	if(co == 'United States')
	{
	   jQuery('#'+txtCty).show();	
	   jQuery('#'+ciu).hide();	  	
	}
	else
	{
		jQuery('#'+txtCty).hide();
		jQuery('#'+ciu).show();	
		data = {f:'gcities', co:co};
		_ajx('inc/misc.php', data, function(x){
							jQuery('#'+ciu).html(x.msgV);
							}, lo, '1', 'json');
	}
}

function rmFrmCart(bID)
{
	data = {f:'rmFrmCart', bID:bID};
	_ajx('inc/misc.php', data, function(x){
									jQuery('#mainTbl').hide();
									jQuery('#msgi').show();
									jQuery('#tblEmpty').show(); 
							}, '', '', 'json');
	
}

//---------------------------FUNCTION FOR GETING EXAMPLE STRING FOR ENDORSEMENTS---------------------------------------
function getEndorseExp(n,g,id)
{
    // n = name to be replaced in the example
    // g = gender for the person -- not being used right now
    // id = id of the textarea
	
	var prevIdx = jQuery('#randendTxt').val();
	var range = prevIdx.substr(1,prevIdx.length).split(',');
	var randNum = Math.floor(Math.random()*range.length);	
	prevIdx = prevIdx.replace(','+range[randNum],'');
	if(prevIdx == '')
	{
		for(var c=0;c<endorseExps.length;c++)
			prevIdx = prevIdx + ',' + c;
	}
	jQuery('#randendTxt').val(prevIdx);
	var endStr = endorseExps[range[randNum]];
	endStr = endStr.replace('__NAME__',n);
	jQuery('#'+id).val(endStr);
}

function clearEndorse(id)
{
	if(jQuery('#'+id).val() != '')
		if(confirm('Are you sure you want to clear the entered endorsement text?'))
		{
			jQuery('#'+id).val('');
			jQuery('#'+id).keypress();
		}
}

function endorseUser(o,uid,tid)
{
	var t = jQuery('#'+tid).val();
	var rel = jQuery('#endRel'+uid).val();
	
	if(rel == '')
	{
		showMsg('endCnt'+uid+'Msg',errMessage('Please select what would you like to endorse for.'));
		return;
	}
	if(t == '')
	{
		showMsg('endCnt'+uid+'Msg',errMessage('Please enter some text for the endorsement.'));
		return;
	}
	jQuery(o).children('span').hide();
	jQuery(o).children('img').show();
	
	var data = {f:'endorseUser',uid:uid,rel:rel,t:t};
	
	_ajx(seekURL+'ajx/network-intros.php', data, function(r){

			if(r.msgType =='ERR')
			{
				jQuery(o).children('span').show();
				jQuery(o).children('img').hide();
				showMsg('endCnt'+uid+'Msg',r.msg);
			}
			else
			{
				jQuery('#endAct'+uid).html(r.msg);
				jQuery('div[rel="endCnt'+uid+'"]').fadeOut(5000,function(){jQuery(this).remove();});
				
				if(r.redirect =='REDIRECTSENT')
				{
					window.location.href = seekURL+"endorsements.php?tb=given";
				}
				updateEndorseSrchList(rel);
			}
	},'' , '', 'json');	
}

function skipEndorse(o,id)
{		
	jQuery(o).children('span').hide();
	jQuery(o).children('img').show();
	
	var data = {f:'skipEndorse',id:id};
	
	_ajx(seekURL+'ajx/network-intros.php', data, function(r){

			jQuery(o).children('span').show();
			jQuery(o).children('img').hide();
			
			if(r.msgType =='SUC')
			{
				jQuery('#endAct'+id).siblings('.skpMsg').hide();
				jQuery('#endAct'+id).show();
				jQuery('#endAct'+id).html(r.msg);
				jQuery('div[rel="endCnt'+id+'"]').fadeOut(5000);
				jQuery('#skpCnt').html(r.skpCnt);
				updateEndorseSrchList(rel);
			}
			else
			{
				jQuery('#endAct'+id).siblings('.skpMsg').children('.lnk').hide();
				jQuery('#endAct'+id).siblings('.skpMsg').append(r.msg);
			}
	},'' , '', 'json');	
}

function rmvEndSkip(o,id)
{
	jQuery(o).children('p').hide();
	jQuery(o).children('img').show();
	
	var data = {f:'rmvEndSkip',id:id};
	
	_ajx(seekURL+'ajx/network-intros.php', data, function(r){
			
			if(r.msgType =='SUC')
			{
				jQuery(o).parent().html(r.msg).fadeOut(5000,function(){jQuery(this).remove(); if(!jQuery('.skpLst').children().length){ jQuery('.skpLst').hide();jQuery('#skpLstMsg').show();}});
				jQuery('#skpCnt').html(r.skpCnt);
			}
			else
			{
				jQuery(o).parent().html(r.msg);
			}
	},'' , '', 'json');	
}

function reqProfInf(i,t,p)
{
	var path = '';
	
	if(typeof(p)!='undefined' && p =='HR')
		path = '';
	else if(typeof(p)!='undefined' && p =='FBDB')
		path = '../';
	else	
		path = seekURL;
	
	 var data = {f:'reqProfInf',i:i,t:t,p:p};
        
	jQuery('#prf_'+t+i).children('a').hide();
	jQuery('#prf_'+t+i).children('img').show();

	_ajx(path+'ajx/network-intros.php', data, function(r){
			
			jQuery('#prf_'+t+i).html(r.msg);
			if(r.p=='END')
				jQuery('#prf_'+t+i).parent().parent().parent().fadeOut(5000, function(){jQuery(this).remove();})
	},'' , '', 'json');
}

function updateEndorseSrchList(rel)
{
	if( typeof(acFs)!='undefined' && acFs.length )
	{
		for (var i=0; i < acFs.length; i++) 
		{
			if( acFs[i].rel.search(rel)>=0 )
			{
				acFs[i].ln = '';
				acFs[i].fn = '';
				break;
			}
		}
	}
}


function loadAutoCompList(inpName,hTxt,funName,index,path)
{
	if(typeof(index) == 'undefined') index='';
	if(typeof(path) == 'undefined') path='';
	//="Type here to search a company"
	jQuery(function() {  
			jQuery("#"+inpName).tokenInput({
				stng:{ 
					url: path+"inc/misc.php", 
					hintText: hTxt,
					noResultsText: "No match found",
					searchingText: "Searching...",
					searchDelay: 180,
					width:jQuery("#"+inpName).parent().css('width'),
					inputwidth:jQuery("#"+inpName).parent().css('width'),
					cntList: 1, // multiselction
					callF:funName,
					ctrlName: inpName,
					allowNew: 'Yes' ,
					index: index
				}
			});			
	});
}


function showTitleMajor(path,index)
{
  var mbbs;
  var inx = index;
  if(typeof(inx) == 'undefined') inx='';   
  
  if(jQuery('#degree'+inx).val()=='')
  {
	jQuery('#userDivision'+inx).hide();
	jQuery('#degTitleArea'+inx).hide();
	jQuery('#dd4M'+inx).hide();
	jQuery('#majorArea'+inx).show();	
	jQuery('#autoComp4Major'+inx).show();
  } 
  else 
  { 
	
	jQuery('#userDivision'+inx).hide();
	jQuery('#degTitleArea'+inx).show();
	if(jQuery('#degree'+inx).val() == 'Matriculation')
	{
	 
	 jQuery.ajax({
				type:"POST",
				url:path+'ajx/db.php', 
				data:({f:'loadMajors',level:jQuery('#degree'+inx).val()}), 				
				success: function(data){					
				jQuery('#majorTitID4Cus'+inx).html(data);
				jQuery('#majorTitID4Cus'+inx).show();
				jQuery('#dd4M'+inx).show();
				jQuery('#majorArea'+inx).show();
				
				}
	 });
	
	 jQuery('#dd4M'+inx).show();
	 jQuery('#autoComp4Major'+inx).hide();
	} 
	else if(jQuery('#degree'+inx).val() == 'Non-Matriculation')
	{	  
	  jQuery('#majorArea'+inx).hide();	
	}
	else if(jQuery('#degree'+inx).val() == 'MBBS')
	{	
	  	jQuery('#majorArea'+inx).hide();
		jQuery('#degTitleArea'+inx).show();
		jQuery('#userDivision'+inx).show();
	  	jQuery('#majorTitID'+inx).val('');
	  	jQuery('#majorTit'+inx).val('');
		mbbs = 'yes';
	}
	else
	{	 
	 jQuery('#majorArea'+inx).show();	
	 jQuery('#dd4M'+inx).hide();
	 jQuery('#autoComp4Major'+inx).show();
	}
  } 
	jQuery.ajax({
		type:"POST",
		url:path+'ajx/db.php', 
		data:({f:'loadMSchools',mbbs:mbbs}), 				
		success: function(data){					
		jQuery('#su_institution'+inx).html(data);
		}
	});
	
	if(mbbs == "yes")
	{
		jQuery('#hjInfoTB'+inx).show();
		jQuery('#qInfoTB'+inx).show();
		jQuery('#profSkiilsInfoTb'+inx).show();
		jQuery('#tr_division'+inx).show();
	}
	else
	{
		jQuery('#hjInfoTB'+inx).hide();
		jQuery('#qInfoTB'+inx).hide();	
		jQuery('#profSkiilsInfoTb'+inx).hide();
		jQuery('#tr_division'+inx).hide();		
	}
	var id = jQuery('#profDegTit'+inx).val();
	id = id.substring(0,id.length-1);	
	if(id !='')
	{
		//console.log('here');
		jQuery('#spmkmDegTitle'+inx+' .token-input-input-token-facebook input').show();
		jQuery('#spmkmDegTitle'+inx).find('li#li_'+id).remove();
		jQuery('#profDegTit'+inx).val('');
		jQuery('#degTitID'+inx).val('');
		jQuery('#degTit'+inx).val('');
	}
}

function upEduInfo(tot)
{							    

	
	//totDeg = document.getElementsByName('su_degree[]').length-1;	
	if(typeof(tot) == 'undefined')
	 totDeg = document.getElementsByName('degree[]').length-1;
	else 
	 totDeg = tot;													
	
	if(totDeg>0)
	{
	 for(i=0;i<totDeg;i++)
	 {		
		if(jQuery('#acadPannelAvailable'+i).val() == 'Yes')
		{
			levl = jQuery('#su_degree'+i).val();
			jQuery('#degTitID'+i).val(jQuery('#profDegTit'+i).val());
			degTitID = jQuery('#degTitID'+i).val();
			if(degTitID!='')
				jQuery('#su_degreeTitle'+i).val(jQuery('#spmkmDegTitle'+i+' #li_'+degTitID).children('p').html());
			else
				jQuery('#su_degreeTitle'+i).val(jQuery('#spmkmDegTitle'+i+' #tmpTxt').val());
			//alert(jQuery('#su_degreeTitle'+i).val());
			//alert(jQuery('#su_degreeTitle'+i).val());
			//levn = jQuery('#su_degreeTitle'+i).val(); 										
			
			//alert(levn);
			
			if(levl=='Non-Matriculation')
			{
		      jQuery('#majorTitID'+i).val('');
			  jQuery('#majorTit'+i).val('');			   
			}
			else if(levl=='Matriculation')
			{			 
			  //alert(jQuery('#majorTitID4Cus'+i).val());
			  jQuery('#majorTitID'+i).val(jQuery('#majorTitID4Cus'+i).val());
			  jQuery('#majorTit'+i).val('');
			}
			else
			{
			 jQuery('#majorTitID'+i).val(jQuery('#profMajorSub'+i).val());
			 mSubID = jQuery('#majorTitID'+i).val();
			 if(mSubID!='')
				jQuery('#majorTit'+i).val(jQuery('#spmkmMajorSub'+i+' #li_'+mSubID).children('p').html());
			 else
				jQuery('#majorTit'+i).val(jQuery('#spmkmMajorSub'+i+' #tmpTxt').val());										 
			
			 //mSub = jQuery('#majorTit'+i).val(); 
			}
			
			
			/*alert(jQuery('#su_degreeTitle'+i).val());
			alert(degTitID);
			alert(jQuery('#majorTit'+i).val());
			alert(mSubID);*/
		}	
	 }
	} 	
}						
								


function saTest(qCnt)
{
	var iCnt,aVal,tID; 
	tID = jQuery('#testID').val();
	
	iCnt = jQuery('#cntQues input[type="radio"]:checked').length;
	if(iCnt < qCnt)
	{
		showMsg('msgDiv',errMessage('Please provide answers of all questions.'));
		return;
	}
	else
	{
		var ans = '';
		for(var i=1; i <= qCnt; i++)
		{
			aVal  =  jQuery('input[name=ans_'+i+']:checked').attr('value');
			ans	 = ans+aVal+'#'; 
		}
				
		 _ajx('inc/misc.php', {f:'assessmentTest', ans:ans,tID:tID},_saTest, '', '', 'json');
	}
}
function _saTest()
{
	fsClose();
	window.location = 'my-rozee.php?suc=Y';
}

