if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;


var status_blur=false;
var status_reblur=false;

function $RF(el, radioGroup)
{
	if($(el).type == 'radio') {
		var el = $(el).form;
		var radioGroup = $(el).name;
	} 
	else if ($(el).tagName.toLowerCase() != 'form') 
	{
		return false;
	}
	return $F($(el).getInputs('radio', radioGroup).find(
		function(re) {return re.checked;}
	));
}


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;
    }
}
function clr(txt, id)
{
    msg = $(id).value;
    if (txt == msg)
        $(id).value='';
}
function shAllComm(sid, hid)
{
    $(hid).hide();
   // Effect.Appear(sid);
    $(sid).show();
}

function selOpt(OptLstNam, LstVal)
{
	for (i=0; i < OptLstNam.length; i++)
	{
		if (OptLstNam.options[i].value == LstVal)
		{
			OptLstNam.selectedIndex = i;
			break;
		}
	}
}

function clearVal(obj,txt){

	if(obj.value==txt)
		obj.value = '';
	else if	(obj.value == '')
		obj.value = txt;
}

function chMoodKP(e)
{
  if (e.keyCode == 13){
    sMood(); return false;
  }
	return true;
}

function chBlurAction()
{
		//alert('chBlurAction = '+status_blur+'\n Reblur == '+status_reblur);
	if (!status_blur)
	{
		sMood();
	}
}

function getCookie(name)
{
	var cookies = document.cookie;
	if (cookies.indexOf(name) != -1)
	{
		var startpos = cookies.indexOf(name)+name.length+1;
		var endpos = cookies.indexOf(";",startpos)-1;
		if (endpos == -2) endpos = cookies.length;
		return unescape(cookies.substring(startpos,endpos));
	}
	else
	{
		return false; // the cookie couldn't be found! it was never set before, or it expired.
	}
}
function winOpen(url, w, h, tb)
{
var w = window.open(url,"","width="+w+",height="+h+",toolbar="+tb+",directories=0,menubar=0,status=0,location=0,scrollbars,resizable" );	
}
function copyAddress()
{
	
	if($("chkBoxCp").checked == true) 
	{
		$('txtPAddress').value = $('txtCAddress').value;
		$('txtPCountry').value = $('txtCCountry').value;
		var from = $('txtCCity'); 
		var to = $('txtPCity'); 
		to.options.length = 0
		for (var i = 0; i < from.options.length; i++)
		{
				to.options.add(new Option(from.options[i].text,from.options[i].value)) 
		}	
		$('txtPCity').value = $('txtCCity').value;
	}
}
function selectMajors(obj)
{
	$('majors').hide(); 
	if(obj.value == '')
	{
		$('degTit').hide();	
		return;
	}
	else
	{
		getJobTitle(obj.value, 'degP');
	}
}

function shCity(cntry, t, cn)
{   
    //c = $('txtCCountry').value;
    p = $H({ f: 'showCity', co: cntry, tar: t, CN:cn}).toQueryString();
    new Ajax.Request('ajx/su.php', 
	{
		method: 'post', 
		parameters: p,
        onSuccess: _shCity,
		onLoading: lding('01',t)
	});
}

function _shCity(msg)
{
    var a = msg.responseText;
	t = a.split("##");
    if (t[0] == "SUC")
    {
		$(t[3]).innerHTML = t[2];
    }
}
function toggleClearText(type, obj, str)
{
	if(type == 'click')
	{
		if(obj.value == str) 
		{
			obj.value = '';
			$(obj).style.color='#444'
		}			
	}
	else
	{
		if(obj.value == '')
		{
			obj.value = str;
			$(obj).style.color='#888'
		}	
	}
}

function saveSettings()
{
	$("btnSave").disable();
	
	if($('insemail'))
		instituteEmail = $('insemail').value;
	else
		instituteEmail = '';
	
	if($('cboPostFix'))
		cboPostFix = $('cboPostFix').value;
	else
		cboPostFix = '';
	
	if($('camploc'))
		camplocation = $('camploc').value;
	else
		camplocation = '';
	
	if( (camplocation=='-1' || camplocation=='') && $('oldPasswd').value=='' && $('newPasswd').value=='' && $('confPasswd').value=='')
	{
		document.location = 'db.php';
	}
	
	p = $H({f:'saveSettings',insemail:instituteEmail ,email:$('email').value,oldP:$('oldPasswd').value,newP:$('newPasswd').value,conP:$('confPasswd').value,camploc:camplocation,cboPostFix:cboPostFix}).toQueryString();
	
	new Ajax.Request('ajx/db.php', 
	{
		method: 'post', 
		parameters: p,
        onSuccess: _saveSettings
	});
}
function _saveSettings(msg)
{
    var a = msg.responseText;
	chkForLogin(a);
	//alert(a);
	t = a.split("##");
	err		= t[0];
	msg 	= t[1];
	
	$("btnSave").enable();
	
	if(err == "ERR")
		new Effect.Opacity('msg', {to: 0.0, from: 1.0, afterFinish:function(){$('msg').innerHTML = msg; Effect.Appear('msg'); Effect.Fade('msg', {duration: 10.0})}});
	else
		document.location = 'db.php?s=Y'
	
}
function pImgs(){var d=document; if(d.images){ if(!d.p) d.p=new Array();var i,j=d.p.length,a=pImgs.arguments; for(i=0; i<a.length; i++)if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=(typeof imgSrv == 'undefined' ? '' : imgSrv) + a[i];}}}
function chkForLogin(msg)
{
	//alert(msg);
	if(msg=='ERRLOGIN')
	{
		document.location = 'login.php?e=5';
	}
}

function showCampLoc(val,ret)
{
	p = $H({ f: 'getCampLoc', campID: val, ret:ret}).toQueryString();
	t = ret.split('##');
    new Ajax.Request('ajx/su.php', 
	{
		method: 'post', 
		parameters: p,
        onSuccess: _showCampLoc,
		onLoading: lding('01',t[1])
	});
}

function _showCampLoc(msg)
{
	var a = msg.responseText;
	dual = a.split('#|#');
	t = dual[0].split('##');
	if(t[0]=='SUC')
	{		
		//alert((t[1]));
		$(t[3]).update(t[1]);
		$(t[2]).show();
	}
	else
	{
		$(t[3]).update('');
		$(t[2]).hide();
	}
	
	t2 = dual[1].split('##');
	if(t2[0]=='SUC')
	{		
		//alert((t[1]));
		$(t[3]+"d").update(t2[1]);
		$(t[2]+"d").show();
	}
	else
	{
		$(t[3]+"d").update('');
		$(t[2]+"d").hide();
	}
	
}

function showCampDep(val,ret)
{
	p = $H({ f: 'getCampDep', campID: val, ret:ret}).toQueryString();
	t = ret.split('##');
    new Ajax.Request('ajx/su.php', 
	{
		method: 'post', 
		parameters: p,
        onSuccess: _showCampDep,
		onLoading: lding('01',t[1])
	});
}

function _showCampDep(msg)
{
	var a = msg.responseText;
	dual = a.split('#|#');
	t = dual[0].split('##');
	if(t[0]=='SUC')
	{		
		//alert((t[1]));
		$(t[3]).update(t[1]);
		$(t[2]).show();
	}
	else
	{
		$(t[3]).update('');
		$(t[2]).hide();
	}	
}




function getEmailPostFixSettings(t,total,sel)
{
	if(total==0)
		return;
		
	if($('camploc'))
		subcamp = $('camploc').value;
	else
		subcamp = '';
		
	p = $H({ f: 'getPostFix', subcamp: subcamp,t:t,sel:sel}).toQueryString();
    new Ajax.Request('ajx/su.php', 
	{
		method: 'post', 
		parameters: p,
        onSuccess: _getEmailPostFixSettings,
		onLoading: lding('01','divPostfix')
	});
}

function _getEmailPostFixSettings(msg)
{
	var a = msg.responseText;
	t = a.split('##');
	if(t[0]=='SUC')
	{
		$('divPostfix').update('@'+t[1]);
	}
	else
	{
		$('divPostfix').update('');
	}
}
function getSpecs(subID,tDiv,from)
{
	if(subID == 'other')
	{
		$('otherDegree').show();
	}
	else if($('otherDegree'))
	{
		$('otherDegree').hide();
	}
	
	p = $H({f:'getSpecs', subID:subID,tDiv:tDiv,from:from}).toQueryString();
    new Ajax.Request('ajx/su.php', 
	{
		method: 'post', 
		parameters: p,
        onSuccess: _getSpecs,
		onLoading: lding('11',tDiv)
	});
}
function _getSpecs(msg)
{
	a = msg.responseText;
	t = a.split('##');
	$(t[0]).update(t[1]);
}
function validateCDO()
{
	p = $H({f:'validateCDO',fName:$('fName').value,lName:$('lName').value,oldPasswd:$F('oldPasswd'),newPasswd:$F('newPasswd'),confPasswd:$F('confPasswd'),txtWPh1:$F('txtWPh1'),txtWPh2:$F('txtWPh2'),txtWPh3:$F('txtWPh3'),txtMPh1:$F('txtMPh1'),txtMPh2:$F('txtMPh2'),txtMPh3:$F('txtMPh3')}).toQueryString();//, compMonth:$F('compMonth'),compYear:$F('compYear')

	new Ajax.Request('ajx/db.php', 
					 
	{
		method: 'post', 
		parameters: p,
      	onSuccess: _validateCDO
	});
}
function _validateCDO(msg)
{
    var a = msg.responseText;
	chkForLogin(a);
	t = a.split("##");
	err		= t[0];
	msg 	= t[1];
	
	if(err == "ERR")
		new Effect.Opacity('msg', {to: 0.0, from: 1.0, afterFinish:function(){$('msg').innerHTML = msg; Effect.Appear('msg'); Effect.Fade('msg', {duration: 10.0, afterFinish:function(){$('msg').update('');} })}});
	else
		document.frmEdit.submit();
	
}
function buildCal(m, y, cM, cH, cMt, cDW, cD, brdr)
{
	var mn=['January','February','March','April','May','June','July','August','September','October','November','December'];
	var dim=[31,0,31,30,31,30,31,31,30,31,30,31];
	
	var oD = new Date(y, m-1, 1); //DD replaced line to fix date bug when current day is 31st
	oD.od=oD.getDay()+1; //DD replaced line to fix date bug when current day is 31st
	
	var todaydate=new Date() //DD added
	var scanfortoday=(y==todaydate.getFullYear() && m==todaydate.getMonth()+1)? todaydate.getDate() : 0 //DD added
	
	dim[1]=(((oD.getFullYear()%100!=0)&&(oD.getFullYear()%4==0))||(oD.getFullYear()%400==0))?29:28;
	var t='<a href="no-events.php" style=" text-decoration:none; cursor:pointer" rel="tiny-show"><div class="'+cM+'"><table class="'+cM+'" cols="7" cellpadding="0" border="'+brdr+'" cellspacing="0"><tr align="center">';
	
	for(s=0;s<7;s++)
		t+='<td class="'+cDW+'">'+"SMTWTFS".substr(s,1)+'</td>';
	t+='</tr><tr align="center">';
	for(i=1;i<=42;i++)
	{
	   var x=((i-oD.od>=0)&&(i-oD.od<dim[m-1]))? i-oD.od+1 : '&nbsp;';
	   if (x==scanfortoday) //DD added
			x='<span id="today">'+x+'</span>' //DD added
	   t+='<td class="'+cD+'">'+x+'</td>';
	   if(((i)%7==0)&&(i<36))
		   t+='</tr><tr align="center">';
	}
	return t+='</tr></table></div></a>';
}

function setLoginFocus()
{
	/*if(navigator.appName == 'Microsoft Internet Explorer')
	{
		var iframe = document.frames['iflogin'];
		var field = document.frames['iflogin'].document.getElementById('email');
	}
	else
	{
		var iframe = document.getElementById('iflogin');
		var field = document.getElementById('iflogin').contentDocument.getElementById('email');
	}
	iframe.focus();
	field.focus();*/
}

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 or higher.
   {
   for(var i=0; i<document.images.length; i++)
      {
	  var img = document.images[i]
	  var imgName = img.src.toUpperCase()
	  if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
	     {
		 var imgID = (img.id) ? "id='" + img.id + "' " : ""
		 var imgClass = (img.className) ? "class='" + img.className + "' " : ""
		 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
		 var imgStyle = "display:inline-block;" + img.style.cssText 
		 if (img.align == "left") imgStyle = "float:left;" + imgStyle
		 if (img.align == "right") imgStyle = "float:right;" + imgStyle
		 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle		
		 var strNewHTML = "<span " + imgID + imgClass + imgTitle
		 + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
	     + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
		 + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
		 img.outerHTML = strNewHTML
		 i = i-1
	     }
      }
   }
  if(window.attachEvent)
	window.attachEvent("onload", correctPNG);
	
	
