// <![CDATA[
/*
* Copyright: 2005 - 2007 SI Works Internet Solutions
* If you have come across this page, its cause you are snooping through code, and are generally a developer as such
* If you would like to use some of the code on this page, please simply email support@siworks.co.za and ask permission
* it would be much appreciated, as we have worked very hard on these func.tions() and scri.pts()
* 
* Note: All functions below are to make sure that we are sticking to standards and are mainly
* for visual effects and loading events and handlers.
*
* Calendar object that builds the calendar and sends Ajax requests
* @page calendar.class.js
* @version 1.0.2
* @author Greg Shiers, Jarratt Ingram (SI Works Internet)
* @copyright: SI Works Internet Solutions 2005 - 2007
*/

var Location = {	
	clearDiv : function (div) {	
		$(div).innerHTML = 'No regions available';
	},
	createRegionElement : function ( countryID , regionName , divName ) {	
		
		if($(divName)){		
			ajaxObject = function () {	
				this.OnLoading = function () {	
					var image = "<img src=\"/images/icons/progress.gif\" alt=\"loading icon\" title=\"loading icon\" class=\"icor\">";
					Location.writeInnerHTML (divName, "<div id=\"progress\">"+image+"Loading. please wait..."+"</div>")
				}
				this.OnSuccess = function () {	
					if(this.GetResponseText() != ''){
						Location.writeInnerHTML ( divName , this.GetResponseText() )
					}
					else{
						Location.clearDiv(divName);
					}
					
				}
				this.GetData = function() {
					this.InitializeRequest('GET', "/location.ajax.php?link=regions&id="+countryID+"&name="+regionName);
					this.Commit(null);
				}
			}
			ajaxObject.prototype = new ajax();
			createEvent = new ajaxObject();
			createEvent.GetData();
		}
	},
	writeInnerHTML : function ( div , results ) {	
		$(div).innerHTML = results;
	}
}