var BASE_PATH = 'http://ugo.co.ug/';
//var BASE_PATH = 'http://127.0.0.1/start/';

//for adding an error to a page
function add_error_msg(msg,div)
{
//first the div if its hidden
$(div).show();
$(div).update("<div class='noticecontainer'><div class='noticefail'><div class='noticeimsgdiv'><br /></div>" + msg +"</div></div>");
}

//for adding an error to a page
function insert_error_msg(msg,div)
{
//first the div if its hidden
$(div).show();
$(div).insert({top:"<div class='noticecontainer'><div class='noticefail'><div class='noticeimsgdiv'><br /></div>" + msg +"</div></div>"});
}

//success msg soft
function add_success_msg_soft(msg,div)
{
//first the div if its hidden
$(div).show();
$(div).update("<div class='noticecontainer'><div class='noticesoft'><div class='noticeimsgdiv'><br /></div>" + msg +"</div></div>");
}

function add_success_msg(msg,div,fadetime)
{
//first the div if its hidden
var i=Math.floor(Math.random()*msg.length);
divid = "noticefade" + i;
$(div).show();
$(div).update("<div class='noticecontainer'><div class='noticefade' id='"+divid+"'>" + msg +"</div></div>");
new Effect.Fade(divid,{ fps: 10, duration: fadetime });
}


function insert_success_msg(msg,div,fadetime)
{
//first the div if its hidden
var i=Math.floor(Math.random()*msg.length);
divid = "noticefade" + i;
$(div).show();
$(div).insert({top :"<div class='noticecontainer'><div class='noticefade' id='"+divid+"'>" + msg +"</div></div>"});
new Effect.Fade(divid,{ fps: 10, duration: fadetime });
}


function insert_ajaxloading_div(msg,div)
{
$(div).show();
//$(div).insert({top :"<div class='ajaxloadingdiv' id='ajaxloadingdiv"+div+"'  style='z-index:10000;display:block;'><img src='"+BASE_PATH+"/start/images/loading.gif'>" + msg +"</div>"});
}


function add_ajaxloading_div(msg,div)
{
$(div).show();
$(div).update("<div class='ajaxloadingdiv' id='ajaxloadingdiv"+div+"'  style='z-index:10000;display:block;'><img src='"+BASE_PATH+"/start/images/loading.gif'>" + msg +"</div>");
}

function hide_ajaxloading_div(div)
{
//alert(div);//new Effect.SlideUp($("ajaxloadingdiv"+div+""), {duration:0.2});
$("ajaxloadingdiv"+div+"").hide();
}

function remove_ajaxloading_div(div)
{
jQuery(function($){
 $('#ajaxloadingdiv'+div).remove();
 });
}




//togglw the divs
function toggleContainer(param,param2)
{
if($(param).hide())
{
$(param2).show();
}
}

function stripString(param)
{
if(typeof(String.prototype.trim) === "undefined")
{
    String.prototype.trim = function()
    {
        return String(this).replace(/^\s+|\s+$/g, '');
    };
}

var str = param.trim();
return str;
}


function print_r(theObj){
  if(theObj.constructor == Array ||
     theObj.constructor == Object){
    document.write("<ul>")
    for(var p in theObj){
      if(theObj[p].constructor == Array||
         theObj[p].constructor == Object){
document.write("<li>["+p+"] => "+typeof(theObj)+"</li>");
        document.write("<ul>")
        print_r(theObj[p]);
        document.write("</ul>")
      } else {
document.write("<li>["+p+"] => "+theObj[p]+"</li>");
      }
    }
    document.write("</ul>")
  }
}

function confirmNavigation(div)
{
jQuery(function($){
$(div).change(function() {
    if( $(this).val() != "" )
        window.onbeforeunload = "Are you sure you want to leave?";
});
 });
}



//utitlity for opening new tab and focusing on it
function openLinkInNewWindow(link) {
var newWindow = window.open(link);
newWindow.focus();
}

//utitlity for posting to new window and selecting radion buttons
function uiPostToNewWindow(url,formid,fields,method)
{
    var form = $(''+formid+'');
    form.action = url;

    //change the submit method
    if(method)
    {
    form.method = method;
    }

     for(var field in fields)
     {
        form.innerHTML += '<input type="hidden" name="' + field + '" value="' + eval('fields["' + field + '"]') + '" />';
        }

    //alert(form.innerHtml);
    form.submit();
}

function uiRadioSelected(parent_id) {
    var options=$(parent_id).getElementsByTagName('input');
	var selected;
	for (var i=0; i<options.length; i++)
		if (options[i].checked)
			return options[i];
	return null;
}


/**
* Function : dump()
* Arguments: The data - array,hash(associative array),object
*    The level - OPTIONAL
* Returns  : The textual representation of the array.
* This function was inspired by the print_r function of PHP.
* This will accept some data as the argument and return a
* text that will be a more readable version of the
* array/hash/object that is given.
*/
function print_r(arr,level) {
var dumped_text = "";
if(!level) level = 0;

//The padding given at the beginning of the line.
var level_padding = "";
for(var j=0;j<level+1;j++) level_padding += "    ";

if(typeof(arr) == 'object') { //Array/Hashes/Objects
 for(var item in arr) {
  var value = arr[item];

  if(typeof(value) == 'object') { //If it is an array,
   dumped_text += level_padding + "'" + item + "' ...\n";
   dumped_text += dump(value,level+1);
  } else {
   dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
  }
 }
} else { //Stings/Chars/Numbers etc.
 dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
}
var html = '<pre>'+dumped_text+'</pre>';
creatediv('print_r',html);
}


//create a new div
function creatediv(id, html, width, height, left, top) {

var newdiv = document.createElement('div'); newdiv.setAttribute('id', id); if (width) { newdiv.style.width = 300; } if (height) { newdiv.style.height = 300; } if ((left || top) || (left && top)) { newdiv.style.position = "absolute"; if (left) { newdiv.style.left = left; } if (top) { newdiv.style.top = top; } } newdiv.style.background = "#FFFFFF"; newdiv.style.border = "1px solid #CCCCCC"; if (html) { newdiv.innerHTML = html; } else { newdiv.innerHTML = "nothing"; } document.body.appendChild(newdiv);
}

function hide_notif(param)
{
$(param).hide();
}

function getViewPortwidth()
{
var viewportwidth;
 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 if (typeof window.innerWidth != 'undefined')
 {
 viewportwidth = window.innerWidth;
 }

// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       viewportwidth = document.documentElement.clientWidth;

 }

 // older versions of IE

 else
 {
       viewportwidth = document.getElementsByTagName('body')[0].clientWidth;
 }
return viewportwidth;
}


function getViewPortHeight()
{

 var viewportwidth;
 var viewportheight;

 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight

 if (typeof window.innerWidth != 'undefined')
 {

      viewportheight = window.innerHeight;
 }

// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       viewportheight = document.documentElement.clientHeight;
 }

 // older versions of IE

 else
 {
 viewportheight = document.getElementsByTagName('body')[0].clientHeight;
 }
return viewportheight;
}


function load_async(url)
{
(function() {
    function async_load(){
        var s = document.createElement('script');
        s.type = 'text/javascript';
        s.async = true;
        s.src = url;
        var x = document.getElementsByTagName('script')[0];
        x.parentNode.insertBefore(s, x);
    }
    if (window.attachEvent)
        window.attachEvent(addLoadEvent(async_load));
    else
        window.addEventListener(addLoadEvent(async_load), false);
})();
}



function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

function showFeedContent()
{

}

function hideFeedContent()
{

}

function makeThisMyHomePage(page)
{
document.body.style.behavior='url(#default#homepage)';
document.body.setHomePage('http://127.0.0.1/start'+page);
}

function performSearch()
{
jQuery(function($){

var searchengineval = $("#searchengineselectbox").val();
var qry = $("#searchqueryinputtextbox").val();

var link;
switch(searchengineval)
{
case 'google':
    link = "http://www.google.co.ug/search?hl=en&source=hp&biw=&bih=&q="+qry+"&btnG=Google+Search";
    break;

case 'yahoo':
    link="http://search.yahoo.com/search;_ylt=A0oG7l4SzJ1Nk3MAtmul87UF?p="+qry+"&fr=sfp&fr2=&iscqry=";
    break;

case 'bing':
    link="http://www.bing.com/search?q="+qry+"&go=&form=QBLH&qs=n&sk=";
    break;

case 'facebook':
    link="https://www.facebook.com/search.php?q="+qry+"&init=quick&tas=0.8860835190862417";
    break;

case 'twitter':
    link="http://search.twitter.com/search?q="+qry;
    break;

case 'wikipedia':
    link="http://en.wikipedia.org/wiki/Special:Search?search="+qry+"&go=Go";
    break;

case 'searchall':
        link="http://www.searchall.com/?q="+qry+"&searchType=web&ilang=&lang=&country=&advanced=false&engines=Google,Live,Yahoo";
        break;

case 'qwiki':
    link="http://www.qwiki.com/q/#!/"+qry+"";
    break;

}

   if (link)
   {
        window.open(link);
        return false;
    }

});
}

function submitHeaderSearch(evt)
{

if($F("searchqueryinputtextbox").length > 0)
{

if(evt)
{
document.onkeypress = function(evt) {
    evt = evt || window.event;
    var charCode = evt.keyCode || evt.which;
    var charStr = String.fromCharCode(charCode);
   if (charCode == 13)
{
performSearch();
}
}
}else
{
performSearch();
}
}
}

function newperformSearch()
{
jQuery(function($){

var searchengineval = $("#newsearchengineselectbox").val();
var qry = $("#newsearchqueryinputtextbox").val();

var link;
switch(searchengineval)
{
case 'google':
    link = "http://www.google.co.ug/search?hl=en&source=hp&biw=&bih=&q="+qry+"&btnG=Google+Search";
    break;

case 'yahoo':
    link="http://search.yahoo.com/search;_ylt=A0oG7l4SzJ1Nk3MAtmul87UF?p="+qry+"&fr=sfp&fr2=&iscqry=";
    break;

case 'bing':
    link="http://www.bing.com/search?q="+qry+"&go=&form=QBLH&qs=n&sk=";
    break;

case 'facebook':
    link="https://www.facebook.com/search.php?q="+qry+"&init=quick&tas=0.8860835190862417";
    break;

case 'twitter':
    link="http://search.twitter.com/search?q="+qry;
    break;

case 'wikipedia':
    link="http://en.wikipedia.org/wiki/Special:Search?search="+qry+"&go=Go";
    break;

case 'searchall':
        link="http://www.searchall.com/?q="+qry+"&searchType=web&ilang=&lang=&country=&advanced=false&engines=Google,Live,Yahoo";
        break;

case 'qwiki':
    link="http://www.qwiki.com/q/#!/"+qry+"";
    break;

}

   if (link)
   {
        window.open(link);
        return false;
    }

});
}

function newsubmitHeaderSearch(evt)
{

if($F("newsearchqueryinputtextbox").length > 0)
{

if(evt)
{
document.onkeypress = function(evt) {
    evt = evt || window.event;
    var charCode = evt.keyCode || evt.which;
    var charStr = String.fromCharCode(charCode);
   if (charCode == 13)
{
newperformSearch();
}
}
}else
{
newperformSearch();
}
}
}

//facebookWidget
function loadFbWidget()
{
  new Ajax.Request(''+BASE_PATH+'facebook_server.php', {
      method: 'get',
      parameters: {action:'loadfbwidget'},evalScripts: true,
	  onCreate: function(){
add_ajaxloading_div('loading your facebook stream','fbwidget');
},

	  onSuccess: function(transport){
$('fbwidget').update(transport.responseText);
},
      onFailure: function() {
add_error_msg('there was an error loading your facebook stream','fbwidget');
    }


  });
}

//facebookWidget
function logoutFbWidget()
{
  new Ajax.Request(''+BASE_PATH+'facebook_server.php', {
      method: 'get',
      parameters: {action:'loadfbwidget'},evalScripts: true,
	  onCreate: function(){
add_ajaxloading_div('you are being logged out of facebook','fbwidget');
},

	  onSuccess: function(transport){
$('fbwidget').update(transport.responseText);
},
      onFailure: function() {
add_error_msg('there was an error logging you out of facebook','fbwidget');
    }


  });
}

function updateFacebookStatus()
{
  new Ajax.Request(''+BASE_PATH+'facebook_server.php', {
      method: 'get',
      parameters: {action:'updatefacebookstatus',fbuid:$F('fbhiddenid'),fbmsg:$F('fbtextarea')},evalScripts: true,
	  onCreate: function(){
insert_ajaxloading_div('you facebook status is being updated','fbwidgetstatusupdate');
},

	  onSuccess: function(transport){
$('fbwidgetstatusupdate').update(transport.responseText);
},
      onFailure: function() {
add_error_msg('there was an error updating your facebook status','fbwidgetstatusupdate');
    }


  });
}

/****twitter***/
function updateTwttrStatus()
{
path = BASE_PATH + 'twitter_server.php';


//alert('update');
  new Ajax.Request(path, {
      method: 'get',
      parameters: {action:'updatetwttrstatus',twttrmsg:$F('twtrrtextarea')},evalScripts: true,
	  onCreate: function(){
insert_ajaxloading_div('you twitter status is being updated','twtrrwidgetstatusupdateerror');
},

	  onSuccess: function(transport){
$('twtrrwidgetstatusupdateerror').update(transport.responseText);
twttrmsg.value = '';
},
      onFailure: function() {
add_error_msg('there was an error updating your twitter status','twtrrwidgetstatusupdateerror');
    }


  });


}



function gadgetDropDownMenu(divid,selectid,server,custommsg)
{

//default server
if(!server)
{
server =  BASE_PATH+'gadget_server.php';
}

//default msg
if(!custommsg)
{
custommsg ="please wait";
}
new Ajax.Request(server, {
      method: 'get',
      parameters: {action:'gadgetdropdownmenu',option:$F(selectid)},evalScripts: true,
	  onCreate: function(){
add_ajaxloading_div(custommsg,divid);
},

	  onSuccess: function(transport){
$(divid).update(transport.responseText);
},
      onFailure: function() {
insert_error_msg('there was an error processing you request',divid);
    }
  });
}


  function translateWidget() {
      var content = document.getElementById('content');
      // Setting the text in the div.
      content.innerHTML = 'Hola, me alegro mucho de verte';

      // Grabbing the text to translate
      var text = document.getElementById('content').innerHTML;

      // Translate from Spanish to English, and have the callback of the request
      // put the resulting translation in the 'translation' div.
      // Note: by putting in an empty string for the source language ('es') then the translation
      // will auto-detect the source language.
      google.language.translate(text, '', 'en', function(result) {
        var translated = document.getElementById('site-body-container');
        if (result.translation) {
          translated.innerHTML = result.translation;
        }
      });
    }


    function jobSearch()
    {
       jQuery(function($){
    var dirlink, parameters;
    var method = null;


    var keyword = $('#jobsearchkeyword').val();

     var directory = [];
     $("input:checkbox[name=jobdirectorycheckbox]:checked").each(function(){
     directory.push($(this).val());
     });


    for(var c = 0;c <= directory.length;c++)
    {
    var dirval = directory[c];
    //dirval.attr("checked",false);


    switch(dirval)
    {
    case 'ugandajobline':
    dirlink = 'http://ugandajobline.com/?s=jobseeker&usertype=jobseeker&key='+keyword+'&location=&search=Search+Jobs';
    break;

    case 'welcometokampala':
    method = ':POST';
    dirlink = 'http://www.welcometokampala.com/jobs.php';
    parameters = {
      "textfield" :	keyword,
      "Submit" :	"Search"
    }
    break;

    case 'ugandajobline':
    dirlink = 'http://ugandajobline.com/?s=jobseeker&usertype=jobseeker&key='+keyword+'&location=&search=Search+Jobs';
    break;

    case 'bestugandajobs':
    method = ':POST';
    dirlink = 'http://www.google.co.tz/cse?cx=partner-pub-8281575316867574%3A4gw491-wzee&ie=ISO-8859-1&q='+keyword+'&sa=Search';
    parameters = {
    "textfield" : Keyword,
    "Submit" : "Search"

    }
    break;

    case 'indeed': //gigajob
    dirlink = 'http://www.indeed.co.in/jobs?q='+keyword+'&l=';
    break;

    case 'classified1000jobs':
    dirlink = 'http://www.classifieds1000.com/cgi-bin/searchh.pl?u=jobs.classifieds1000.com&q='+keyword+'';
    break;

    case 'jobseastafrica':
    method = ':POST';
    dirlink = 'http://www.jobseastafrica.com/search/'+keyword+'';
    parameters = {
    "keywords" : Keyword,
    "Submit" : "Search"

    }
    break;

    case 'gigajob':
    dirlink = 'http://ug.gigajob.com/job/'+keyword+'.html?geostring=Kampala';
    break;

    }

    }



      if (dirlink)
    {
      uiPostToNewWindow(dirlink,'jobSearchForm', parameters,method);

    //reset the method
     //return false;
    }


    });


    }


        function searchAll()
{
jQuery(function($){

 var keyword = $('#directorysearchkeyword').val();




  if(keyword.length > 0)
    {
     window.open(BASE_PATH+'searchall.php?q='+keyword);
    }

});
}


    function directorysearch()
    {

    jQuery(function($){
    var dirlink, parameters;
    var method = 'GET';


    var keyword = $('#directorysearchkeyword').val();

     var directory = [];
     $("input:checkbox[name=searchdirectorycheckbox]:checked").each(function(){
     directory.push($(this).val());
     });


    for(var c = 0;c <= directory.length;c++)
    {
    var dirval = directory[c];
    //dirval.attr("checked",false);


    switch(dirval)
    {
    case  'infoug':
    dirlink = 'http://directory.infoug.com/search_results.php?keyword='+ keyword +'&submit=Search';
     parameters = {
                    service : 'mail',
                    "continue" : "http://directory.infoug.com"

                };
    break;

    case 'monitordirectory':
    dirlink ='http://www.monitordirectory.co.ug/results.php?keyword='+ keyword+'&template_id=';
     parameters = {
                    service : 'mail',
                    "continue" : "http://www.monitordirectory.co.ug/results.php",
                    "templateIDID" : ''
                };
    break;

    case 'uglinks':
    dirlink = 'http://www.uglinks.com/?s='+keyword;
    break;

    case 'yellowpages':
    method = 'get';
    dirlink = 'http://www.yellowpages-uganda.com/search.html';
    parameters = {
      "continue" : "http://www.yellowpages-uganda.com/search.html",
      "cof" :	"FORID:10",
      "cx"	 : "partner-pub-3071649474288922:7zqdinvp1ni",
      "ie" : "ISO-8859-1",
      "q" :	keyword,
      "sa" :	"Search",
      "siteurl" : "www.yellowpages-uganda.com"
    }
    break;


    case 'eayellowpages':
    dirlink = 'http://find.eayellowpages.com/search_results.php?keyword='+keyword+'&category=&location=&submit=Search';
    break;

    case 'habarisearch':
    dirlink = 'http://www.habarisearch.com/controller.php?what='+keyword+'&location=0&plugin=locations&file=search&search=Search';
    break;

    case 'openuganda':
    dirlink = 'http://directory.openuganda.com/directory/index.php?search='+keyword+'';
    break;

    case "searchall":
            searchAll();
            break;


    }



    if (dirlink)
    {
      uiPostToNewWindow(dirlink,'directorySearchForm', parameters,method);

    //reset the method
     //return false;
    }
    }

    });
    }


/**
 * Plugin: jquery.zWeatherFeed
 *
 * Version: 1.0.2
 * (c) Copyright 2010, Zazar Ltd
 *
 * Description: jQuery plugin for display of Yahoo! Weather feeds
 *
 * History:
 * 1.0.2 - Correction to options / link
 * 1.0.1 - Added hourly caching to YQL to avoid rate limits
 *         Uses Weather Channel location ID and not Yahoo WOEID
 *         Displays day or night background images
 *
 **/

(function($){


	$.fn.minweatherfeed = function(locations, options) {

		// Set pluign defaults
		var defaults = {
			unit: 'c',
			image: true,
			highlow: true,
			wind: true,
			link: true,
			showerror: true,

            //options for content
            wimage:false,
            wtemp:false,
            wtemptxt:false,
            wcity:false

		};
		var options = $.extend(defaults, options);

		// Functions
		return this.each(function(i, e) {
			var $e = $(e);

			// Add feed class to user div
			if (!$e.hasClass('minweatherFeed')) $e.addClass('minweatherFeed');

			// Check and append locations
			if (!$.isArray(locations)) return false;
			var count = locations.length;
			if (count > 10) count = 10;
			var locationid = '';
			for (var i=0; i<count; i++) {
				if (locationid != '') locationid += ',';
				locationid += "'"+ locations[i] + "'";
			}

			// Cache results for an hour to prevent overuse
			now = new Date()

			// Create Yahoo Weather feed API address
			var query = "select * from weather.forecast where location in ("+ locationid +") and u='"+ options.unit +"'";
			var api = 'http://query.yahooapis.com/v1/public/yql?q='+ encodeURIComponent(query) +'&rnd='+ now.getFullYear() + now.getMonth() + now.getDay() + now.getHours() +'&format=json&callback=?';

			// Send request
			//$.getJSON(api, function(data) {
			$.ajax({
				type: 'GET',
				url: api,
				dataType: 'json',
				success: function(data) {

					if (data.query) {

						if (data.query.results.channel.length > 0 ) {

							// Multiple locations
							var result = data.query.results.channel.length;
							for (var i=0; i<result; i++) {

								// Create weather feed item
								_callback(e, data.query.results.channel[i], options);
							}
						} else {

							// Single location only
							_callback(e, data.query.results.channel, options);
						}
					} else {
						if (options.showerror) $e.html('<p>Weather information unavailable</p>');
					}
				},
				error: function(data) {
					if (options.showerror)  $e.html('<p>Weather request failed</p>');
				}
			});

		});
	};

	// Function to each feed item
	var _callback = function(e, feed, options) {
		var $e = $(e);

		// Format feed items
		var wd = feed.wind.direction;
		if (wd>=348.75&&wd<=360){wd="N"};if(wd>=0&&wd<11.25){wd="N"};if(wd>=11.25&&wd<33.75){wd="NNE"};if(wd>=33.75&&wd<56.25){wd="NE"};if(wd>=56.25&&wd<78.75){wd="ENE"};if(wd>=78.75&&wd<101.25){wd="E"};if(wd>=101.25&&wd<123.75){wd="ESE"};if(wd>=123.75&&wd<146.25){wd="SE"};if(wd>=146.25&&wd<168.75){wd="SSE"};if(wd>=168.75&&wd<191.25){wd="S"};if(wd>=191.25 && wd<213.75){wd="SSW"};if(wd>=213.75&&wd<236.25){wd="SW"};if(wd>=236.25&&wd<258.75){wd="WSW"};if(wd>=258.75 && wd<281.25){wd="W"};if(wd>=281.25&&wd<303.75){wd="WNW"};if(wd>=303.75&&wd<326.25){wd="NW"};if(wd>=326.25&&wd<348.75){wd="NNW"};
		var wf = feed.item.forecast[0];

		// Determine day or night image
		wpd = feed.item.pubDate;
		n = wpd.indexOf(":");
		tpb = _getTimeAsDate(wpd.substr(n-2,8));
		tsr = _getTimeAsDate(feed.astronomy.sunrise);
		tss = _getTimeAsDate(feed.astronomy.sunset);

		if (tpb>tsr && tpb<tss) { daynight = 'd'; } else { daynight = 'n'; }

		// Add item container
		var html = new Array();



		if (options.image)
        html['image'] = '<img class="iepngfix minweatherfeedimage" src="http://l.yimg.com/a/i/us/nws/weather/gr/'+ feed.item.condition.code + daynight +'.png">';

		// Add item data
		html['city']=  feed.location.city ;

		html['temp'] = feed.item.condition.temp +'&deg;</div></div>';


		html['temptxt'] =  feed.item.condition.text ;
		if (options.highlow) html['weatherRange'] =  wf.high +'&deg; Low: '+ wf.low +'&deg;';
		if (options.wind) html['weatherWind'] =  wd +' '+ feed.wind.speed + feed.units.speed;
		if (options.link) html['weatherLink'] =  feed.item.link ;


        //return the array
		//return html;
        //alert(html.serializeArray());

    var htmlstr;

    if(options.wimage)
    {
    htmlstr = html['image'];
    }

    if(options.wtemp)
    {
    htmlstr += html['temp'];
    }

    if(options.wtemptxt)
    {
    htmlstr +=html['temptxt'];
    }

    if(options.wcity)
    {
     htmlstr +=html['city'];
    }


    $e.append(htmlstr);

	};

	// Get time string as date
    // Get time string as date
	var _getTimeAsDate = function(t) {

		d = new Date();
		r = new Date(d.toDateString() +' '+ t);

		return r;
	};

})(jQuery);


