function initDiv(divItem) { 
	for(var i = 0; i < divItem.length; i++){
		divItem[i].style.visibility = 'visible'; 
		divItem[i].style.display = 'block'; 
		var d = document.createElement('DIV'); 
		d.innerHTML = displayDiv(); 
		divItem[i].parentNode.replaceChild(d.firstChild, divItem[i]); 
	}
} 

function hexosearchVote(){
	if(hexosearch_keyword != null & isFilled(hexosearch_keyword)){
	}
}

function displayDiv(){
	
	var type = "";
	if(typeof(hexosearch_type) !== 'undefined'){
		switch(hexosearch_type){
			case "any":
				type = 0;
				break;
			case "actionscript 2":
				type = 1;
				break;
			case "actionscript 3":
				type = 2;
				break;
			case "flex":
				type = 3;
				break;
		}
	}
	
	var keywords = "";
	if(typeof(hexosearch_keyword) !== 'undefined'){
		if(isFilled(hexosearch_keyword)){
			keywords = UrlEncode(hexosearch_keyword);
		}else{
			keywords = "";
		}
	}
	
	var url = "http://www.hexosearch.com/se/submit.aspx";
	if(typeof(hexosearch_test) !== 'undefined'){
		if(isFilled(hexosearch_test)){
			url = "http://www.hexosearch.com/se/submit_test.aspx";
		}else{
			url = "http://www.hexosearch.com/se/submit.aspx";
		}
	}
	
	var str = "";
	if(typeof(hexosearch_display) !== 'undefined'){
		switch(hexosearch_display){
			case "icon":
				str += "<a href='"+url+"?zurlz="+UrlEncode(document.location)+"&zqz="+keywords+"&ztz="+UrlEncode(document.title)+"&zlvz="+type+"' target='_blank'><img src='http://www.hexosearch.com/tools/logo.gif' border='0' /></a>";
				break;
			case "text":
				str += "<a href='"+url+"?zurlz="+UrlEncode(document.location)+"&zqz="+keywords+"&ztz="+UrlEncode(document.title)+"&zlvz="+type+"' target='_blank'>HexoSearch</a>";
				break;
			default:
				str += "<a href='"+url+"?zurlz="+UrlEncode(document.location)+"&zqz="+keywords+"&ztz="+UrlEncode(document.title)+"&zlvz="+type+"' target='_blank'><img src='http://www.hexosearch.com/tools/logo.gif' border='0' /></a> <a href='"+url+"?zurlz="+UrlEncode(document.location)+"&zqz="+keywords+"&ztz="+UrlEncode(document.title)+"&zlvz="+type+"' target='_blank'>HexoSearch</a>";
				break;
		}
	}else{
		str += "<a href='"+url+"?zurlz="+UrlEncode(document.location)+"&zqz="+keywords+"&ztz="+UrlEncode(document.title)+"&zlvz="+type+"' target='_blank'><img src='http://www.hexosearch.com/tools/logo.gif' border='0' /></a> <a href='"+url+"?zurlz="+UrlEncode(document.location)+"&zqz="+keywords+"&ztz="+UrlEncode(document.title)+"&zlvz="+type+"' target='_blank'>HexoSearch</a>";
	}
	return str;
}
	  
var divItem = []; 
var elem = document.body.getElementsByTagName('script'); 
for (var i = 0; i < elem.length; i++) { 
	if (elem[i].src == "http://www.hexosearch.com/tools/hexosearch.js") { 
		divItem.push(elem[i]); 
	} 
} 
if (divItem.length) { 
	var oldFunc = window.onload; 
	if (typeof window.onload != 'function') 
		window.onload = function() { 
			initDiv(divItem);
		} 
	else 
		window.onload = function() { 
			oldFunc(); 
			initDiv(divItem); 
		}
}

function isFilled(str) {
	if (str.length > 0) {
		for (var i = 0; i < str.length; i++) {
			if (str.charAt(i) != " ") {
				return true;
			}
		}
		return false;
	} else {
		return false;
	}
}

function UrlEncode(value) {
	var unencoded = value;
	value = escape(unencoded);
	return value;
}
function UrlDecode(value) {
	var encoded = value;
	value = unescape(encoded.replace(/\+/g, " "));
	return value;
}

