var baseUrl = 'www.ne.se';
var neRainbow = function(options){
	
	var s1,s2,bg,attr='frameBorder="0" marginWidth="0" marginHeight="0" scrolling="no"';
	
	if(typeof(options) == 'undefined') {
		var options = {};
	}
	
	if(typeof(options.width) !== 'undefined') {
		attr+=' width="'+options.width+'"';
	} else {
		attr+=' width="100%"';
	}
	
	if(typeof(options.height) !== 'undefined') {
		attr+=' height="'+options.height+'"';
	} else {
		attr+=' height="400px"'
	}
	
	//attr+='style="background:#fff"';

	if (typeof(options.negative) === 'undefined') {
		options.negative = false;
	}
	
	if(options.negative) {
		attr+=' src="http://'+ baseUrl + '/static/tools/html/rainbow.html?negative=true"';
		bg = '#000';
	} else {
		attr+=' src="http://'+ baseUrl + '/static/tools/html/rainbow.html"';
		bg = '#fff';
	}
	
	if (typeof(options.border) === 'undefined') {
		options.border = true;
	}
	
	if(options.border) {
		if (options.negative) {
			s1 = 'border:1px solid #777;';
			s2 = 'border:8px solid #000';
		} else {
			s1 = 'border:1px solid #ccc;';
			s2 = 'border:8px solid #fff';
		}
	}
	
	document.write('<div style="background:'+bg+';'+s1+'"><iframe '+attr+'style="background:'+bg+';'+s2+'"></iframe></div>');
	
}

var neLoadDropdown = function(options){
   
	var attr = '';
	if(typeof(options) == 'undefined') {
		var options = {};
	}
	if(typeof(options.width) !== 'undefined') {
		attr+=' width="'+options.width+'"';
	} else {
		attr+=' width="100%"';
	}
	
    document.write('<div id="neWidget"style="'+attr+'">');
    document.write('<link rel="stylesheet" type="text/css" href="http://'+ baseUrl + '/static/tools/css/neWidgetContainer-base-min.css" media="all">');
	document.write('<script src="http://'+ baseUrl + '/static/tools/js/jquery-1.2.6.pack.js" type="text/javascript"></scr'+'ipt>');
	document.write('<script src="http://'+ baseUrl + '/static/tools/js/jquery.ajaxQueue.js" type="text/javascript"></scr'+'ipt>');
	document.write('<script src="http://'+ baseUrl + '/static/tools/js/jquery.animate.js" type="text/javascript"></scr'+'ipt>');
	document.write('<script src="http://'+ baseUrl + '/static/tools/js/ne.search.js" type="text/javascript"></scr'+'ipt>');
	document.write('<script src="http://'+ baseUrl + '/static/tools/js/ne.dropdown.js" type="text/javascript"></scr'+'ipt>');
	document.write('<div id="neWidgetContainer">\
		<div class="frm">\
		<fieldset>\
		<legend>Sök i Encyklopedin</legend>\
		<div>\
		<span class="neSearchField"><input type="text" name="query" class="neQuery" autocomplete="off" value=""><span></span></span>\
		<span class="neSearchBtn"><a class="submit_anchor">sök</a></span>\
		</div>\
		</fieldset>\
		</div>\
		<div class="neActivesearch">\
		</div>\
	</div>\
	</div>');
}

function neDropDown() {
    jQuery(function($) { $("#neWidgetContainer").neDropdown(); });
}

