	
	function scriptRequest(id,url,callback){
		this.url=url;
		this.callback=callback;
		this.header=document.getElementsByTagName("head").item(0);
		this.scriptID=id;
	}
	scriptRequest.prototype.generateTag=function(){
		this.oScript=document.createElement("script");
		
		this.oScript.setAttribute("type","text/javascript");
		this.oScript.setAttribute("src",this.url+"&callback="+this.callback+"&noCacheIE="+(new Date()).getTime());
		this.oScript.setAttribute("id",this.scriptID);
	}
	scriptRequest.prototype.removeTag=function(){
		this.header.removeChild(this.oScript);
	}
	scriptRequest.prototype.addTag=function(){
		this.header.appendChild(this.oScript);
	}
	
	function cssRequest(){
		this.header=document.getElementsByTagName("head").item(0);
	}
	cssRequest.prototype.generateTag=function(){
		this.oCss=document.createElement("link");
		this.oCss.setAttribute("href","http://www.jobs4careers.com.au/widgets/j4c_advert.css");
		this.oCss.setAttribute("rel","stylesheet");
		this.oCss.setAttribute("type","text/css");
	}
	cssRequest.prototype.removeTag=function(){
		this.header.removeChild(this.oCss);
	}
	cssRequest.prototype.addTag=function(){
		this.header.appendChild(this.oCss);
	}
	
	var oCss=new cssRequest();
	oCss.generateTag();
	oCss.addTag();
	
	var j4c={
		kw:'',
		wh:'',
		
		searchtime:0,
		oSearch:'',
		
		curpage:'s',
		
		page:function(itemID){
			document.getElementById('j4c_'+this.curpage).style.display='none';
			document.getElementById('j4c_'+this.curpage+'_tab').style.backgroundPosition='top';
			
			this.curpage=itemID;
			document.getElementById('j4c_'+itemID).style.display='block';
			document.getElementById('j4c_'+itemID+'_tab').style.backgroundPosition='bottom';
			
			if(itemID=='r'){
				j4c.resources();
			}
		},
		resources:function(){
			var output=document.getElementById('j4c_r');
			output.innerHTML='Loading ...';
			
			this.oSearch=new scriptRequest("searchScript","http://www.jobs4careers.com.au/widgets/j4c_advert.php?g=r","j4c.resources_fill()");
			this.oSearch.generateTag();
			this.oSearch.addTag();
		},
		resources_fill:function(){
			this.oSearch.removeTag();
			
			var output=document.getElementById('j4c_r');
			output.innerHTML='';
			
			var vl=video['title'].replace(/ /g,'_');
			var v=document.createElement('div');
			v.setAttribute("id","v");
			v.innerHTML='<img align="left" src="http://www.jobs4careers.com.au/images/film75.jpg" style="margin-bottom:25px;" /><p><a href="http://www.jobs4careers.com.au/widgets/landing.php?id=&url=/news/video/'+video['id']+'/'+vl+'.html">'+video['title']+'</a></p><p style="font:8pt Arial;">'+video['abstract']+'</p>';
			output.appendChild(v);
			
			for(var i=0;i< news.length ;i++){
				var nl=news[i]['title'].replace(/ /g,'_');
				var n=document.createElement('div');
				n.setAttribute("class","n");
				n.setAttribute("className","n");
				n.innerHTML='NEWS <a href="http://www.jobs4careers.com.au/widgets/landing.php?id=&url=/news/'+news[i]['id']+'/'+nl+'.html">'+news[i]['title']+'</a>';
				output.appendChild(n);
			}
			
			var no=document.createElement('p');
			no.innerHTML='See more news at Jobs4Careers.com.au';
			output.appendChild(no);
		},
		results:function(){
			this.oSearch.removeTag();
			this.searchtime=(((new Date()).getTime()-this.searchtime)/1000)+" seconds";
			
			var output=document.getElementById('sr');
			output.innerHTML='';
			for(var i=0;i< listings.length ;i++){
				var ji=document.createElement('div');
				ji.setAttribute("class","jl");
				ji.setAttribute("className","jl");
				ji.innerHTML=listings[i]['state']+' <a href="http://www.jobs4careers.com.au/widgets/landing.php?id=&url='+listings[i]['link']+'">'+listings[i]['ref']+'</a>';
				output.appendChild(ji);
			}
			
			var js=document.createElement('p');
			js.innerHTML='See more <b>'+this.kw+'</b> jobs at Jobs4Careers.com.au';
			output.appendChild(js);
		},
		search:function(){
			var output=document.getElementById('sr');
			output.innerHTML='Loading ...';
			
			this.searchtime=(new Date()).getTime();
			
			this.kw=document.getElementById('kw').value;
			this.wh=document.getElementById('wh').options[document.getElementById('wh').selectedIndex].value;
			
			this.oSearch=new scriptRequest("searchScript","http://www.jobs4careers.com.au/widgets/j4c_advert.php?k="+encodeURIComponent(this.kw)+"&w="+encodeURIComponent(this.wh),"j4c.results()");
			this.oSearch.generateTag();
			this.oSearch.addTag();
		}
	}