//Populate default value for AreaOfInterest & ProgramsOfInterestType - used in search & CC version
function populateDefaultValue(){
	var requestAOI='AreaOfInterest';
	var requestPOIType='ProgramsOfInterestType';
	var valAOI='AreaOfInterest';
	var valPOIType='ProgramsOfInterestType';
	var selectElements=document.getElementsByTagName('select');
	
	// BUG127228 Hitting back on CampusCorner defaults you to AOI1 of Art and Design
	// If the form submit is not valid, either restore the values to default or retain the values provided by the user.
	// Currently we are setting the values back to default(Select Any)
	
	var aoiSelectElement = null;
	for (var i=0; i<selectElements.length; i++) {
			if(valAOI == selectElements[i].name ){
				aoiSelectElement = selectElements[i];
			}
	}
	var selAOI = $("select[name='AreaOfInterest']").val();
	// End of BUG127228
	
	//ENH116795 by bgharate
	requestAOI = requestAOI.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); 
	var regexS = "[\\?&]"+requestAOI+"=([^&#]*)";  
	var regex = new RegExp( regexS );  
	var resultsAOI = regex.exec( window.location.href ); 
	if( resultsAOI == null ) {
		//When user hits back, the ajax call needs to happen again to populate the AOI2
		if(null != document.form.AreaOfInterest && '---Select a Program---' != document.form.AreaOfInterest.value)
		{
			getSubSubjects(selAOI,null);
		}
	}else{ 
		//For ProgramsOfInterestType
		requestPOIType=requestPOIType.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); 
		regexS = "[\\?&]"+requestPOIType+"=([^&#]*)";  
		regex = new RegExp( regexS );  
		var resultsPOIType = regex.exec( window.location.href ); 
		setValidAOI(aoiSelectElement,resultsAOI[1]);
		if(null != resultsPOIType)
			getSubSubjects(resultsAOI[1],resultsPOIType[1]);
		else 
			getSubSubjects(resultsAOI[1],null);
					
	}
	var checkAOIHeader = aoiSelectElement.options[0].value;
	if( (checkAOIHeader != '---Select a Program---') && (checkAOIHeader != '---Any Program---')) {
		//aoiSelectElement.options[0] = new Option("---Select a Program---", "---Select a Program---");
		var oOption = document.createElement('OPTION');
 	  	oOption.value = '---Select a Program---';
 	  	//oOption.disabled = true;
 	    oOption.innerHTML = '---Select a Program---'; 
		aoiSelectElement.insertBefore(oOption,aoiSelectElement.options[0]); 
	}
}

/*
This Function returns the new AOI/AOI2 skins for old AOI/AOI2 skins 
*/
function setValidAOI(aoiSelectElement,areaOfInterest)
{
	$.ajax({
				type: "GET",
				url: "getNewAoiMapping.jsp",
				data: { aoi: areaOfInterest},
				success: function(data){
					aoiSelectElement.value = data;
				}
		});			 
}

function doProcessing() {
	if(document.getElementById('submitBtn') != null){
		document.getElementById('submitBtn').className = 'thide'; 
	}	
	if(document.getElementById('submitBtnBigBlue') != null){
		document.getElementById('submitBtnBigBlue').className = 'thide'; 
	}	
	if(document.getElementById('submitBtnBigOrange') != null){
		document.getElementById('submitBtnBigOrange').className = 'thide'; 
	}		
	if(document.getElementById('getinfo') != null){
		document.getElementById('getinfo').className = 'thide'; 
	}	
	document.getElementById('processing').className = 'tshow';  
}

function doPopUpProcessing(){
	  document.getElementById('popUp_submit').className = 'thide';
	  document.getElementById('processing1').className = 'tshow';
}

function openWin(page,win_width,win_height) {

    try {
    	popup_window.close();
    } catch(e) {
					
    }

    if ( page.indexOf("mailto") == -1 ) {
    	var options = "scrollbars=yes, width=" + win_width + ", height=" + win_height;
    	var win = window.open(page, 'MyWin', options);
    	if (window.focus) { win.focus() }
    }
}

// On_change method for State field
function onChangeSP() {
	try{
		var cn = document.form.SP.value.substring(0,2);
		if(cn == "US" || cn == "CA" || cn == "UM"){
			document.form.CN.value = cn;
			//document.form.PC.disabled = '';
		}else{
			document.form.CN.value = '---Select One---';
			
			//document.form.PC.disabled = 'disabled';
		}
	}catch(e){}
}

function onChangeSP_TEMP() {
	try{
		var cn = document.form.SP_TEMP.value.substring(0,2);
		if(cn == "US" || cn == "CA" || cn == "UM"){
			document.form.CN_TEMP.value = cn;
			//document.form.PC.disabled = '';
		}else{
			document.form.CN_TEMP.value = '---Select One---';
			
			//document.form.PC.disabled = 'disabled';
		}
	}catch(e){}
}

// On_change method for Country field
function onChangeCN() {
	try{
		if ( document.form.CN.value == "US" 
				|| document.form.CN.value == "UM"
				|| document.form.CN.value == "CA" ) {
			//document.form.PC.disabled = '';
			//document.form.SP.disabled = '';
		}else{
			//document.form.PC.value = '';
			document.form.SP.value = '(Unspecified)';
			//document.form.PC.disabled = 'disabled';
	//		document.form.SP.disabled = 'disabled';
		}
	}catch(e){}
}

function onChangeCN_TEMP() {
	try{
		if ( document.form.CN_TEMP.value == "US" 
				|| document.form.CN_TEMP.value == "UM"
				|| document.form.CN_TEMP.value == "CA" ) {
			//document.form.PC.disabled = '';
			//document.form.SP.disabled = '';
		}else{
			//document.form.PC.value = '';
			document.form.SP_TEMP.value = '(Unspecified)';
			//document.form.PC.disabled = 'disabled';
	//		document.form.SP.disabled = 'disabled';
		}
	}catch(e){}
}

function displaySelectedSchool( vKeyjs ) {
	if(!vKeyjs || vKeyjs == -1){
		vKeyjs = schoolArray[0].vendorKey;
	}

	var index = 0;
	for( var i=0; i<schoolArray.length; i++ ) {
		document.getElementById( 'schoolBox' + (i+1) ).className = "schoolBox";
		if( schoolArray[i].vendorKey == vKeyjs ) {
			document.getElementById( 'schoolBox' + (i+1) ).className = "selectedBox";
			var posY = document.getElementById( 'schoolBox' + (i+1) ).offsetTop;
			var browserName=navigator.appName; 
			if (browserName=="Netscape"){ 
				posY = posY - 159;
			}else if (browserName=="Microsoft Internet Explorer"){
				//do nothing!?
				posY = posY + 10;
			}
			document.getElementById('selectedBoxRight').style.top = posY + 'px';
			document.getElementById('selectedBoxRight').style.height = 
				document.getElementById( 'schoolBox' + (i+1) ).offsetHeight + 'px';
			document.getElementById('rightImage').style.height = 
				document.getElementById( 'schoolBox' + (i+1) ).offsetHeight + 'px';
			document.getElementById('selectedBoxRight').style.width = '21px';
			index = i;
		}
	}

	document.getElementById( 'selectedLogo' ).innerHTML		= "<img src='" + schoolArray[index].logoURL
						+ "' alt='" + schoolArray[index].vendorName + "'>";
	document.getElementById( 'selectedName' ).innerHTML		= schoolArray[index].vendorName;
	document.getElementById( 'selectedDesc' ).innerHTML		= schoolArray[index].blurb;
	if(document.getElementById( 'programsLink' )){
		document.getElementById( 'programsLink' ).href	= "javascript:openCampusProgWin('show/programs.jsp?module=search&vendorKey="
			+ schoolArray[index].vendorKey + "', '520', '460')";
	}
	if(document.getElementById( 'locationsLink' )){
		document.getElementById( 'locationsLink' ).href	= "javascript:openCampusProgWin('show/campuslocations.jsp?vendorKey=" 
			+ schoolArray[index].vendorKey + "', '520', '460')";
	}

	document.form.selectedVendorKey.value = schoolArray[index].vendorKey;
}

function openCampusProgWin(page,win_width,win_height) {

    try {
    	popup_window.close();
    } catch(e) {
    }

    if ( page.indexOf("mailto") == -1 ) {
    	var options = "resizable=1,scrollbars=yes, width=" + win_width + ", height=" + win_height;
    	var win = window.open(page, 'MyWin', options);
    	if (window.focus) { win.focus();}
    }
}
 function getXMLHTTP()
	  { //fuction to return the xml http object
			var xmlhttp=false;	
			try{
				xmlhttp=new XMLHttpRequest();
			}
			catch(e)	{		
				try{			
					xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
				}
				
				catch(e){
					try{
					xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
					}
					catch(e1){
						xmlhttp=false;
					}
				}
			}
		 	
		return xmlhttp;
    }
    
function getSubSubjects(rootSubject,valuPOIType){
	$("select[name='ProgramsOfInterestType']").attr("disabled", false);
	$("#AreaOfInterest option[value='" + rootSubject +"']").attr('selected', 'selected');
	
	var listOfAoi2=document.form.ProgramsOfInterestType.options;
	if(rootSubject=='---Any Program---') {
		document.getElementById('ProgramsOfInterestType').style.display='none';
		return;
	}
	else if(rootSubject=='---Select a Program---') {
		document.getElementById('ProgramsOfInterestType').style.display='none';
		return;
	}
	else
	document.getElementById('ProgramsOfInterestType').style.display='block';
	$.ajax({
				type: "POST",
				url: "findSubSubject.jsp",
				data: { subject: rootSubject,POIType : valuPOIType},
				success: function(data){
					if(data == null || data === ''){
						$.ajax({
							type: "POST",
							url: "findSubSubject.jsp",
							data: { subject: rootSubject,POIType : null},
							success: function(data){
								$("select[name=ProgramsOfInterestType]").html(data);
					
								try{
									var programHeader=document.getElementById('hiddenProgramHeader');
									if(programHeader!=null){
										programHeader=programHeader.value;
										for(var i=0;i<listOfAoi2.length;i++){
											
											if(programHeader.toLowerCase() == listOfAoi2[i].value.toLowerCase()){
												listOfAoi2[i].selected = "true";								
											}
										}
										
										if(document.form.ProgramsOfInterestType.value!='---Any Program---'){
											document.getElementById('programheader').style.display = "block";
										}else{
											document.getElementById('programheader').style.display = "none";						
										}
									}
								}catch(error){
								}							
							}
						});	
					}else{
					$("select[name=ProgramsOfInterestType]").html(data);
					
					try{
						var programHeader=document.getElementById('hiddenProgramHeader').value;
						if(programHeader!=null){
							for(var i=0;i<listOfAoi2.length;i++){
								if(programHeader.toLowerCase() == listOfAoi2[i].value.toLowerCase()){
									listOfAoi2[i].selected = "true";								
								}
							}
							
							if(document.form.ProgramsOfInterestType.value!='---Any Program---'){
								document.getElementById('programheader').style.display = "block";
							}else{
								document.getElementById('programheader').style.display = "none";						
							}
						}
					}catch(error){
					}
				}
				}
		});
}

function cleansePOI(){
		//Enable POI to be self-sustainable if grouped
		$("select[name^='ProgramOfInterest']").each(function(){
			var newPOI = $(this).clone(true).empty(), optGroup = undefined;
			$(this).find("option").each(function(){
				if(this.value.indexOf('::LABEL::') > -1 ){
					if(optGroup != undefined)
						newPOI.append(optGroup);
					optGroup = $("<optgroup />").attr('label', this.text).addClass($(this).attr('class'));
				}else if(optGroup != undefined){
					optGroup.append(this);
				}else
					newPOI.append(this);
			});
			newPOI.append(optGroup);
			newPOI[0].selectedIndex = 0;
			$(this).replaceWith(newPOI);
		});
	}

function bubblePrograms(bestMatches,selectBoxName,poi)
{
	if($("select[name="+selectBoxName+"] option").size() > 1)
		$("select[name="+selectBoxName+"] option:eq(0)").after("<option value='::LABEL::OTHERPROGRAMS'>"+"Other Programs Offered At This School"+"</option>");
	addPOIBestMatches(bestMatches[1],selectBoxName,"Other Relevant Matches","poiDropDownRelevant");
	addPOIBestMatches(bestMatches[0],selectBoxName,"Your Best Matches","poiDropDown");
	cleansePOI();
	if('' != poi)
	{
		$("#ProgramOfInterest option[value='" + poi +"']").attr('selected', 'selected');
	}
}

function bubbleProgramsForCallCenter(bestMatches,selectBoxName)
{
		
		if($("select[name="+selectBoxName+"] option").size() > 1)
			$("select[name="+selectBoxName+"] option:eq(0)").after("<option value='::LABEL::OTHERPROGRAMS'>"+"Other Programs Offered At This School"+"</option>");
		addPOIBestMatches(bestMatches[1],selectBoxName,"Other Relevant Matches","poiDropDownRelevant");
		addPOIBestMatches(bestMatches[0],selectBoxName,"Your Best Matches","poiDropDown");		
}
	
function bubbleProgramsWithPreselection(bestMatches,selectBoxName,poi,poiDegree,lcTheme)
{
		if($("select[name="+selectBoxName+"] option").size() > 1)
			$("select[name="+selectBoxName+"] option:eq(0)").after("<option value='::LABEL::OTHERPROGRAMS'>"+"Other Programs Offered At This School"+"</option>");
		addPOIBestMatches(bestMatches[1],selectBoxName,"Other Relevant Matches","poiDropDownRelevant");
		addPOIBestMatches(bestMatches[0],selectBoxName,"Your Best Matches","poiDropDown");
		if('' != poi)
		{
			var foundBestMatches=foundBestRelativeMatches(bestMatches[0]);
			var foundRelaiveMatches=foundBestRelativeMatches(bestMatches[1]);
			
			if(undefined == $("#ProgramOfInterest option[value='"+poi+"']").val())
			{
				var highestdegree;
			var matchClass;
			if(foundBestMatches)
			{
				matchClass = "poiDropDown";
			}
			else if(foundRelaiveMatches)
			{
				matchClass = "poiDropDownRelevant";
			}
			//Hack to get the highest degree offered within the best or relevant matches
			$("#ProgramOfInterest option").each(function(i){
			if(matchClass == $(this).attr("class") && this.value.indexOf('::LABEL::') > -1)
			{
				if(this.value.indexOf('::LABEL::CERTIFICATE') > -1)
				{
					highestdegree = 'CERTIFICATE';
				}
				if(this.value.indexOf('::LABEL::COURSEWORK') > -1)
				{
					highestdegree = 'COURSEWORK';
				}
				if(this.value.indexOf('::LABEL::DIPLOMA') > -1)
				{
					highestdegree = 'DIPLOMA';
				}
				if(this.value.indexOf('::LABEL::ASSOCIATE') > -1)
				{
					highestdegree = 'ASSOCIATE';
				}
				else if(this.value.indexOf('::LABEL::BACHELOR') > -1)
				{
					highestdegree = 'BACHELOR';
				}
				else if(this.value.indexOf('::LABEL::MASTER') > -1)
				{
					highestdegree = 'MASTER';
				}
				else if(this.value.indexOf('::LABEL::DOCTORATE') > -1)
				{
					highestdegree = 'DOCTORATE';
				}
			}
			});
				poiDegree = highestdegree;
				var bestMatchesList; 
				if(foundBestMatches)
				{
					bestMatchesList = bestMatches[0][highestdegree];
				}
				else if(foundRelaiveMatches)
				{
					bestMatchesList = bestMatches[1][highestdegree];
				}
				var programavail = false;
				if(undefined != bestMatchesList)
				{
					for (var program in bestMatchesList) 
					{
						i = program;
						for(var programVal in bestMatchesList[i])
						{
							if(poi == programVal)
							{
								programavail = true;
								break;
							}
						}
					}
					if(!programavail)
					{
						//generate random number to select a program randomly from the filtered list
						var randomnumber=Math.floor(Math.random()* bestMatchesList.length);
						for(var program in  bestMatchesList[randomnumber])
						{
							poi = program;
						}
					}
				}
			}
			cleansePOI();
			if(foundBestMatches || foundRelaiveMatches)
			{
				
				$("#ProgramOfInterest option[value='" + poi +"']").attr('selected', 'selected');
				var degreeLevelString = ""
				if(undefined != poiDegree && '' != poiDegree && null != poiDegree)
					degreeLevelString = '<div id="poiDegreeLevel"><div id="poiDegreeText"><b>Degree level:&nbsp;</b></div><div id="poiDegree">'+poiDegree.toLowerCase()+'</div></div>';
				//prepare the div to hide the dropdown and show the Change link
				$('div#ProgramOfInterest').hide();
				divid = 'div#ProgramOfInterest';
				divclass = 'poiLink';
				if('CC' == lcTheme || 'SDC' == lcTheme)
				{
					divid = 'div#questions';
					divclass = 'poiLinkCtrl';
				}
				$(divid).after(
		     		$('<div id="'+ divclass + '" > <div id="poiText" ><b>Your Best Program Match</b></div>'
		     		+degreeLevelString
		     		+'<div id ="poiProgram"><div id ="poiProgramText"><b>Program:</b></div>'
		     		+'<div id="poiPreselect">' 
   					+ $("#ProgramOfInterest option[value='" + poi +"']").text()
   					+'<br /><a id="changeProgram">(change program?)</a> </div></div></div>').find('a').click(function(){
		     			$('#' + divclass).hide();
		     			$('#ProgramOfInterest').show();
		     			return false;
		     			}).end()
		     		);
		     		$("#ProgramOfInterest span.error").not(":empty").each(function(){
		     			$('#' + divclass +' a').click();
		     		});
			}
		}
		else
		{
			//Starting POI Preselect based on Highest Degree only when Best or Relevant matches are available.
			var foundBestMatches=foundBestRelativeMatches(bestMatches[0]);
			var foundRelaiveMatches=foundBestRelativeMatches(bestMatches[1]);
			if(foundBestMatches || foundRelaiveMatches)
			{
				var highestdegree;
				var matchClass;
				if(foundBestMatches)
				{
					matchClass = "poiDropDown";
				}
				else if(foundRelaiveMatches)
				{
					matchClass = "poiDropDownRelevant";
				}
				//Hack to get the highest degree offered within the best or relevant matches
				$("#ProgramOfInterest option").each(function(i){
				if(matchClass == $(this).attr("class") && this.value.indexOf('::LABEL::') > -1)
				{
					if(this.value.indexOf('::LABEL::CERTIFICATE') > -1)
					{
						highestdegree = 'CERTIFICATE';
					}
					if(this.value.indexOf('::LABEL::COURSEWORK') > -1)
					{
						highestdegree = 'COURSEWORK';
					}
					if(this.value.indexOf('::LABEL::DIPLOMA') > -1)
					{
						highestdegree = 'DIPLOMA';
					}
					if(this.value.indexOf('::LABEL::ASSOCIATE') > -1)
					{
						highestdegree = 'ASSOCIATE';
					}
					else if(this.value.indexOf('::LABEL::BACHELOR') > -1)
					{
						highestdegree = 'BACHELOR';
					}
					else if(this.value.indexOf('::LABEL::MASTER') > -1)
					{
						highestdegree = 'MASTER';
					}
					else if(this.value.indexOf('::LABEL::DOCTORATE') > -1)
					{
						highestdegree = 'DOCTORATE';
					}
				}
				});
				var bestMatchesList; 
				if(foundBestMatches)
				{
					bestMatchesList = bestMatches[0][highestdegree];
				}
				else if(foundRelaiveMatches)
				{
					bestMatchesList = bestMatches[1][highestdegree];
				}
				//generate random number to select a program randomly from the filtered list
				var randomnumber=Math.floor(Math.random()* bestMatchesList.length);
				var programSel;
				var programDesc;
				for(var program in  bestMatchesList[randomnumber])
				{
					programSel = program;
					programDesc = bestMatchesList[randomnumber][program];
				}
				cleansePOI();
				//pre-select the option we are planning to show as best match
				$("#ProgramOfInterest option[value='" + programSel +"']").attr('selected', 'selected');
				//prepare the div to hide the dropdown and show the Change link
				var degreeLevelString = ""
				if(undefined != highestdegree && '' != highestdegree)
					degreeLevelString = '<div id="poiDegreeLevel"><div id="poiDegreeText"><b>Degree level:</b></div><div id="poiDegree">'+highestdegree.toLowerCase()+'</div></div>';
				$('div#ProgramOfInterest').hide();
				divid = 'div#ProgramOfInterest';
				divclass = 'poiLink';
				if('CC' == lcTheme || 'SDC' == lcTheme)
				{
					divid = 'div#questions';
					divclass = 'poiLinkCtrl';
				}
				$(divid).after(
    			$('<div id="'+divclass+'" > <div id="poiText" ><b>Your Best Program Match</b></div>'
		     		+ degreeLevelString
		     		+'<div id ="poiProgram"><div id ="poiProgramText"><b>Program:</b></div>'
		     		+'<div id="poiPreselect">' 
    			+ programDesc
    			+'<br/><a id="changeProgram">(change program?)</a> </div></div></div>').find('a').click(function(){
		     			$('#'+divclass).hide();$('#ProgramOfInterest').show();return false;
		     			}).end()
		     			);
		     	$("#ProgramOfInterest span.error").not(":empty").each(function(){
		     			$('#' + divclass + ' a').click();
		     	});
			}
			else
			{
				cleansePOI();
			}
		}
		//Ending POI Preselect based on Highest Degree only when Best or Relevant matches are available.	
}

function removeOtherMatches(){
	
	$("#ProgramOfInterest option").each(function(i){
	    if(undefined === $(this).attr("class") && "---Select One---" != $(this).val()){
	    	if($(this).text() != 'Your Best Matches' && $(this).text() != 'Other Relevant Matches'){
	    		$(this).parents("OPTGROUP").remove();
	 	        $(this).remove();
	 	        $("#ProgramOfInterest optgroup[label='Other Programs Offered At This School']").remove();
	    	}
	     }
	});
}

function foundBestRelativeMatches(bestMatches){
	var anyBestMatches = false;
	if(null != bestMatches ) 
	{
		for (var degree in bestMatches) 
		{
			degreeMatchList = bestMatches[degree];
			if(degreeMatchList.length > 0)
			for(var i in degreeMatchList)
			{
				anyBestMatches = true;
			}	
		}
	}
	return anyBestMatches;
}
function addPOIBestMatches(bestMatches,selectBoxName,displayString,cssClass)
{
	if(null != bestMatches ) 
	{
		var anyBestMatches = false;
		var bestMatchesOptions = "<option value='::LABEL::BESTMATCHES' >"+displayString+"</option>";
		for (var degree in bestMatches) 
		{
			degreeMatchList = bestMatches[degree];
			if(degreeMatchList.length > 0)
				bestMatchesOptions +="<option value='::LABEL::"+degree+"' class='"+cssClass+"'>--------"+degree+"--------</option>";
			for(var i in degreeMatchList)
			{
				anyBestMatches = true;
				for(var program in degreeMatchList[i])
				{
					bestMatchesOptions +="<option id='bachelor'"+program+"  value='"+program+"' class='"+cssClass+"'>"+degreeMatchList[i][program]+"</option>"
				}
			}
		}
		if(anyBestMatches)
		{
			if(jQuery.browser['msie'])
				bestMatchesOptions+="<option value='::LABEL::EMPTYVALUE' disabled></option>";
			else 
				bestMatchesOptions+="<option value='::LABEL::EMPTYVALUE' disabled></option><option value='EMPTYVALUE' disabled></option>"
			$("select[name="+selectBoxName+"] option:eq(0)").after(bestMatchesOptions)
		}
	}			
}

function skipCurrentVendorOnLC(){
	
	$('select').each(function(index){
		 var attrName=$(this).attr('name')+'_temp';
		 $(this).attr('name',attrName);
	});
	document.form.skipvendor.value='true';
}

function doProcessingLC2(){
	document.form.IsSubmit.value='true';
	document.getElementById('submitBtnLC').className = 'thide'; 	
	document.getElementById('processing').className = 'tshow';
}
function displayLinks(showDivName){
	
	var divName="#"+showDivName;

	//Get the screen height and width
	
	var maskHeight = $("#container").height();
	var maskWidth = $('#container').width();

	//Set heigth and width to mask to fill up the whole screen
	$('#mask').css({'width':maskWidth,'height':maskHeight});
	
	//transition effect		
	$('#mask').fadeIn(1000);	
	$('#mask').fadeTo("slow",0.8);	

	//transition effect
	$('#container').fadeIn(2000); 	
	$(divName).css('display','inline-block');	  			
//if close button is clicked
$('.window .close').click(function (e) {
	//Cancel the link behavior
	e.preventDefault();
	
	$('#mask').hide();
	$('.window').hide();
});				
};	


