/**
 *  Dealshunter.co.uk code
 *  Coded by dejko1 (a t) hotmail (d ot) com
 *  Copyright 2009 dejko1 (a t) hotmail (d ot) com
 */
function au (s) {
 document.write(unescape(s));
}
 
 function getelem(id) {
	  if (document.getElementById) { // DOM3 = IE5, NS6
	   return document.getElementById(id);
	  } else {
	   if (document.layers) { // Netscape 4
			return document.id;
	   } else { // IE 4
	    return document.all.id;
	   }
	  }
	 }
	 
	 function getdisplay(id) {
	  if (document.getElementById) { // DOM3 = IE5, NS6
	   return document.getElementById(id).style;
	  } else {
	   if (document.layers) { // Netscape 4
			return document.id;
	   } else { // IE 4
	    return document.all.id.style;
	   }
	  }
	 }

function tmhide(id) {
 getelem(id).timer=setTimeout("hide('"+id+"');",5);
}

function tmshow(id) {
 clearTimeout(getelem(id).timer);
}
	 
function hide(id) {
	getelem(id).style.borderColor='#ffffff';
	id='float'+id;
	getdisplay(id).display='none';
}

function show(id) {
	getelem(id).style.borderColor='#464646';
	id='float'+id;
	getdisplay(id).display='block';
	getelem(id).style.top=(-Math.floor((getelem(id).offsetHeight/2)-70))+"px";
}

function imgsize (id,height, width) {
 if (!window.XMLHttpRequest) {
  if (document.getElementById(id).clientWidth < document.getElementById(id).clientHeight) {
		  document.getElementById(id).style.height=height;
		 } else {
		  document.getElementById(id).style.width=width;
		 }
 }
}

/***********************************************
* Dynamic Ajax Content- ? Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
var bustcacheparameter=""

function ajaxpage(url, containerid){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
if (bustcachevar) //if bust caching of external page
bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', url+bustcacheparameter, true)
page_request.send(null)
}

function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=parseScript(page_request.responseText)
}

// Source: http://www.developersnippets.com/2009/05/20/evaluate-scripts-while-working-on-ajax-requests/; edited by me

function parseScript(_source) {
		var source = _source;
		var scripts = new Array();
 
		// Strip out tags
		while(source.indexOf("<script") > -1 || source.indexOf("</script") > -1) {
			var ss = source.indexOf("<script");
			var s_e = source.indexOf('>', ss);
			var e = source.indexOf("</script", ss);
			var e_e = source.indexOf(">", e);
 			// Add to scripts array
			//ss=s;
			eval(source.substring(s_e+1, e));
			
			// Strip from source
			source = source.substring(0, ss) + unescape(s) + source.substring(e_e+1);
		}

		// Return the cleaned source
		return source;
}
