	var recordId = null;
    
	function searchKeyword(){
		var word = document.getElementById("keyword").value;  
		showGrid();
		clearContent();
		course_search(word, {target:'content', preloader:'pr'});
	
	} 
	
	function searchCertification(){
		var word = document.getElementById("certid").value;  
		showGrid();
		clearContent();
		certification_search(word, {target:'content', preloader:'pr'});
	
	} 
	
	function searchCertifications(word){ 
		showGrid();
		clearContent();
		certification_search(word, {target:'content', preloader:'pr'});
	
	} 
	
	function searchKeywords(word){ 
		showGrid();
		clearContent();
		course_search(word, {target:'content', preloader:'pr'});
	
	} 
	 //clear content
	function clearContent(){
		document.getElementById("content").innerHTML = "";
	}
	
	
	//send details to actual page
	function doWork(data){
		recordId = data.course_descriptions_id;
		printDetails(data);
	}
	
	//get the result from a course query	
	function refreshCourse(courseid) {
		clearText();
		getCourseByID(courseid, {   
			"preloader": "loader",   
			"content_type": "json",   
			"onFinish": function(response){ 
				doWork(response);     
			}   
    	});   
	} 
	 
	 //print course details
	function printDetails(data){
		document.getElementById("classname").innerHTML = data.course_name;
		document.getElementById("description").innerHTML = data.course_description;
		document.getElementById("topics").innerHTML = data.course_topics;
		document.getElementById("notes").innerHTML = data.course_notes;
		document.getElementById("prereqs").innerHTML = data.course_prerequisite;
		document.getElementById("course_image").innerHTML = '<img src= "images/' + data.course_image + '" />';
		
		
	}
	
	//send location details to actual page
	function doLocationWork(data){
		printLocationDetails(data);
	}
	
	//get the result from a location query	
	function refreshLocation(locid) {
		clearLocationDetails();
		getLocation(locid, {   
			"preloader": "loader",   
			"content_type": "json",   
			"onFinish": function(response){ 
				doLocationWork(response);     
			}   
    	});   
	} 
	 
	 //print course location details
	function printLocationDetails(data){
		document.getElementById("locationname").innerHTML = "<h3>" + data.location_name + "</h3>";
		document.getElementById("locationtxt").innerHTML = "<h5>" + data.location_description + "</h5>";
		document.getElementById("locationtxt").innerHTML += "<br><h2>Hotel Information:<h2><br><br>";
		document.getElementById("locationtxt").innerHTML += '<img src= "images/' + data.location_hotel_image + '" class="img-indent" width="150" height="100" />' + data.location_hotel;
		document.getElementById("locationtxt").innerHTML += "<br>" + data.location_address + "<br>" + data.location_phone;
		document.getElementById("locationquote").innerHTML = data.location_quote;
		document.getElementById("locationstudent").innerHTML = data.location_student;
		document.getElementById("locationimg").innerHTML = '<img src= "images/' + data.location_image + '" class="img-indent" width="205" height="247" />';
		
	}
	
	 //clear course location details
	function clearLocationDetails(){
		document.getElementById("locationname").innerHTML = "";
		document.getElementById("locationimg").innerHTML = "";
		document.getElementById("locationtxt").innerHTML = "";
		document.getElementById("locationtxt").innerHTML = "";
		document.getElementById("locationquote").innerHTML = "";
		document.getElementById("locationstudent").innerHTML = "";
		document.getElementById("locationimg").innerHTML = "";	
		
	}
	
	function clearText(){
		document.getElementById("classname").innerHTML = "";
		document.getElementById("description").innerHTML = "";
		document.getElementById("topics").innerHTML = "";
		document.getElementById("course_image").innerHTML = "";
		document.getElementById("notes").innerHTML = "";
		document.getElementById("prereqs").innerHTML = "";
		
	}

	function getRecordId(){
		return recordId;
	}
	 
	function GridHeader(type, header){
		if(type == "over"){
			header.style.backgroundColor = "#FFE8E8";
			header.style.cursor = "pointer";
		}else{
			header.style.backgroundColor = "#FFFFFF";
		}
	}
	
	function showElement(elementName){
		document.getElementById(elementName).style.display = "block";
		document.getElementById(elementName).style.visibility = "visible";
	}
	
	function hideElement(elementName){
		document.getElementById(elementName).style.display = "none";
	}   
	
	function showGrid(){
		document.getElementById("grid").style.visibility = "visible";
	}
	
	function showDateGrid(){
		document.getElementById("date_grid").style.display = "block";
		document.getElementById("date_grid").style.visibility = "visible";
	}
	
	function hideDateGrid(){
		document.getElementById("date_grid").style.display = "none";
	}   

	function sendForm_array(form){   
    var plx = new phpliveX();   
    return plx.SubmitForm(form, {   
        "preloader":"pr",   
		"content_type": "json",
        "onFinish": function(response){   
           showGrid();
		   getContent("1", "courses_date", response.category, response.type, {target: "content", preloader: "listing"}); 
        }   
    });   
	} 

	function sendForm(form){   
    var plx = new phpliveX();   
    return plx.SubmitForm(form, {   
        "preloader":"pr",   
        "onFinish": function(response){  
			document.getElementById("contents").innerHTML = response;
        }   
    });   
	}
	
	function sendFormTo(form, element){   
    var plx = new phpliveX();   
    return plx.SubmitForm(form, {   
        "preloader":"pr",   
        "onFinish": function(response){  
			document.getElementById(element).innerHTML = response;
        }   
    });   
	}
	
 
	function subscribe(){     
		val = document.getElementById("email").value;
		document.getElementById("email").value = '';
		newsletter_subscribe(val, {'target':'msg','preloader':'pr'}); 
	}	    
  
	function sendForm_alert(form){   
		var plx = new phpliveX();   
		return plx.SubmitForm(form, {   
			"preloader":"pr",   
			"onFinish": function(response){   
				alert(response);   
			}   
		});   
	}   

