<?xml version="1.0" encoding="UTF-8" ?>
<Module>
 <ModulePrefs height="500" 
title="Our Pic Of The Day"
title_url="http://www.meteo-si.com/"
description="Displays the POD based on your own choice. You may choose the exact picture (just write the web address of the picture, e.g. http://www.meteo-si.com/pic/images/laz.jpg  or folder, e.g. http://www.meteo-si.com/pic/images/ to get all pictures from that folder. Use your imagination to get pictures of cars, nature, art, babes, holidays, friends and family. Use your own pictures – just copy them into the web directory. A fresh picture with every refresh. Use your or your friend’s pictures or find the public directory with appropriate images. Navigation between pictures (move mouse over the top right corner shows the navigator). Thumbnail view and full screen view - click the maximize button in the upper right hand corner to view the full screen canvas. Share the gadget and its content with your friends, who are able to view and/or edit your setup, e.g. upload holiday pictures and share them with friends." 
author="AdaptA d.o.o." 
author_email="info@adapta.si"
author_location="Ljubljana, Slovenia, EU"
author_affiliation="AdaptA"
author_photo="http://www.meteo-si.com/adapta-sign.png"
author_aboutme="We develop for you gadgets and gadget ads!"  
author_link="http://www.adapta-solutions.com/solutions/gadgets.html" 
author_quote="Simplify!" 
screenshot="http://www.meteo-si.com/pic/our-picoftheday/our-picoftheday280.png" 
thumbnail="http://www.meteo-si.com/pic/our-picoftheday/our-picoftheday_120.png" 
>
	
	<Require feature="analytics" />
	<Require feature="views" />
	<Require feature="dynamic-height"/>
	<Require feature="setprefs"/>
	<optional feature="shareable-prefs"/> 
 </ModulePrefs>
 <UserPref name="myphoto" display_name="Photo/Directory" default_value="http://www.meteo-si.com/pic/images/"/>
 <UserPref name="lastphoto" display_name="Last viewed" datatype="hidden" default_value=""/>
 <UserPref name="random" display_name="Choose images at random?" datatype="bool" default_value="true"/>
 <UserPref name="thumbnails" display_name="Show thumbnails?" datatype="bool" default_value="true"/>
 <UserPref name="jpg" display_name="Show jpg images?" datatype="bool" default_value="true"/>
 <UserPref name="gif" display_name="Show gif images?" datatype="bool" default_value="true"/>
 <UserPref name="png" display_name="Show png images?" datatype="bool" default_value="true"/>
 <UserPref name="xlarge" display_name="Show Extra Large images?" datatype="bool" default_value="true"/>
 <UserPref name="large" display_name="Show Large images?" datatype="bool" default_value="true"/>
 <UserPref name="medium" display_name="Show Medium images?" datatype="bool" default_value="true"/>
 <UserPref name="small" display_name="Show Small images?" datatype="bool" default_value="false"/>
 <UserPref name="today" datatype="hidden" default_value="" />
<Content type="html" view="home">
<![CDATA[

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<SCRIPT language="JavaScript">
<!--
pic1= new Image(100,25); 
pic1.src="http://www.meteo-si.com/pic/our-picoftheday/left.gif";
pic2= new Image(100,25);
pic2.src="http://www.meteo-si.com/pic/our-picoftheday/left-shadow.gif";
pic3= new Image(100,25);
pic3.src="http://www.meteo-si.com/pic/our-picoftheday/right.gif";
pic4= new Image(100,25);
pic4.src="http://www.meteo-si.com/pic/our-picoftheday/right-shadow.gif";
//-->
</SCRIPT>
</head>
<body onload="start()">

   <script type="text/javascript">

	var linx = new Array();
        var curLink = 0;
	var t;
	var iVal, ival1, tmpImg;
	var docWidth= document.body.clientWidth;
	var prefs = new _IG_Prefs();
	var movingLeft = false;

        function findPos(obj){
		var curleft = curtop = 0;
		if (obj.offsetParent) {
			do {
				curleft += obj.offsetLeft;
				curtop += obj.offsetTop;
			} while (obj = obj.offsetParent);
		}
		return [curleft,curtop];
	}


	function rectangle(w,h,x,y,bg,bCol,name) 
	{ 
		 var rect = document.createElement("div"); 
 		 rect.setAttribute('id',name);
		 var style = rect.style; 
		 style.width = w + "px"; 
		 style.height = h + "px"; 
		 style.left = x + "px"; 
		 style.top = y +"px"; 
		 style.backgroundColor = bg; 
		 style.borderColor = bCol; 
		 style.position = "absolute"; 
		 style.borderStyle = "solid" 
		 style.borderWidth = 1+"px"; 
		 return rect 
	}
	
	function createDiv(x,y,name){
		 var elem = document.createElement("div"); 
 		 elem.setAttribute('id',name);
		 var style = elem.style; 
		 style.top=y;
		 style.left=x;
		 style.position = "absolute"; 
		 return elem
	}

	function createImage(loc,name){
		 var elem = document.createElement("img"); 
 		 elem.setAttribute('id',name);
		 elem.src=loc;
		 var style = elem.style; 
		 style.position = "absolute";
		 style.cursor = "pointer"; 
		 return elem
	}

	function movedOffImage(e){
		var posx = 0;
		var posy = 0;
		if (!e) var e = window.event;
		if (e.pageX || e.pageY){
			posx = e.pageX;
			posy = e.pageY;
		}
		else if (e.clientX || e.clientY){
			posx = e.clientX + document.body.scrollLeft
				+ document.documentElement.scrollLeft;
			posy = e.clientY + document.body.scrollTop
				+ document.documentElement.scrollTop;
		}
		var temp=document.getElementById('navRect');
		var rL= parseInt(temp.style.left.substring(0,temp.style.left.length-2));
		var rT=parseInt(temp.style.top.substring(0,temp.style.top.length-2));
		var rW=parseInt(temp.style.width.substring(0,temp.style.width.length-2));
		var rH=parseInt(temp.style.height.substring(0,temp.style.height.length-2));
		if (posx>rL+rW || posy<rT){	
			document.body.removeChild(temp);
			removeNavElements();
		}
		
	}


	function removeNavElements(){
				if (temp=document.getElementById('navRect')){
					document.body.removeChild(temp);
				}
				if (itemL=document.getElementById('navLeft')){
			                if (temp1=document.getElementById('prev')){
						itemL.removeChild(temp1);
					}
					document.body.removeChild(itemL);
				}
				if (item1=document.getElementById('navRight')){
			                if (temp2=document.getElementById('next')){
						item1.removeChild(temp2);
					}
					document.body.removeChild(item1);
				}

	}

        function removeNavigation(e){
		var posx = 0;
		var posy = 0;
		if (!e) var e = window.event;
		if (e.pageX || e.pageY){
			posx = e.pageX;
			posy = e.pageY;
		}
		else if (e.clientX || e.clientY){
			posx = e.clientX + document.body.scrollLeft
				+ document.documentElement.scrollLeft;
			posy = e.clientY + document.body.scrollTop
				+ document.documentElement.scrollTop;
		}

                if (temp=document.getElementById('navRect')){
			var rL= parseInt(temp.style.left.substring(0,temp.style.left.length-2));
			var rT=parseInt(temp.style.top.substring(0,temp.style.top.length-2));
			var rW=parseInt(temp.style.width.substring(0,temp.style.width.length-2));
			var rH=parseInt(temp.style.height.substring(0,temp.style.height.length-2));
			if (!(posx>=rL && posx<rL+rW+3 && posy>rT && posy<=rT+rH+2)){	
		                document.body.removeChild(temp);
				removeNavElements();
			}
		}
	}

	function nextImage(){
		movingLeft=false;
                var tImg=document.getElementById('next');
		tImg.src="http://www.meteo-si.com/pic/our-picoftheday/right.gif";
		iVal1=setInterval("nextImage1()",300);
	}	

	function nextImage1(){
		if (document.getElementById('next').complete){
			clearInterval(iVal1);
			if (prefs.getBool("random") == true){
				displayImage(2);
				removeNavElements();
			}		
			else if (curLink<linx.length-1){
				curLink++;
				displayImage(2);
				removeNavElements();
			}
			else fitNavigation();
		}
	}

	function prevImage(){
                var tImg=document.getElementById('prev');
		tImg.src="http://www.meteo-si.com/pic/our-picoftheday/left.gif";
		iVal1=setInterval("prevImage1()",300);
	}	

	function prevImage1(){
		if (document.getElementById('prev').complete){
			clearInterval(iVal1);
			if (prefs.getBool("random") == true){
				displayImage(2);
				removeNavElements();
			}		
			else if (curLink>0){
				movingLeft=true;
				curLink--;
				displayImage(2);
				removeNavElements();
			}
			else fitNavigation();
		}
	}

	function fitNavigation(){
		var item=document.getElementById('timg');


                if (temp=document.getElementById('navRect')){
			document.body.removeChild(temp);
		}
		var T=document.getElementById('T1');
		var offsets = findPos(T);

		removeNavElements();

		var rect = rectangle(5,5,100,5,"#EEEEEE","#CCCCCC","navRect");
		var itemL = createDiv(5,5,"navLeft");
		var item1 = createDiv(5,5,"navRight");
		
		var imgLeft = createImage("http://www.meteo-si.com/pic/our-picoftheday/left-shadow.gif",'prev');
		imgLeft.onclick=function(){
			prevImage();
		}
		var imgRight = createImage("http://www.meteo-si.com/pic/our-picoftheday/right-shadow.gif",'next');
		imgRight.onclick=function(){
			nextImage();
		}

                offsets[0]+=T.width-8-item.width;
		offsets[1]+=6;
                calc = offsets[0]+item.width-imgRight.width-5;
		item1.style.left=calc+"px";
		calc = offsets[1]+3;
		item1.style.top =calc+"px";
		calc = offsets[0]+item.width-imgRight.width-imgLeft.width-5;
		itemL.style.left=calc+"px"
		calc = offsets[1]+3;
		itemL.style.top =calc+"px";
		calc=imgRight.width+imgLeft.width+11;
		rect.style.width=calc+"px";
		calc=imgRight.height+4;
		rect.style.height=calc+"px";
		calc=offsets[0]+item.width-imgRight.width-imgLeft.width-12;
		rect.style.left=calc+"px";	
		calc=offsets[1]+1;
		rect.style.top=calc+"px";


		document.body.appendChild(rect);
		itemL.appendChild(imgLeft);
		item1.appendChild(imgRight);
		document.body.appendChild(itemL);
		document.body.appendChild(item1);
	}


	function removeI(j){
		if ((curLink>j-1)&&(curLink>0)) curLink--;
		for (i=j;i<linx.length-1;i++) linx[i]=linx[i+1];
		linx.length=linx.length-1;
		if (curLink>(linx.length-1)) curLink--;
	}


	function removeDuplicates(){
		var i=0;
		var j=1;
		while (i<linx.length-1){
			if (linx[i]==linx[j]) removeI(j);
			else j++;
			if (j>linx.length-1) {
				i++;
				j=i+1;
			}
		}
		displayImage(2);
	}


	function parseDir(responseText) {
		var nLinx = -1;        
		var sLink = 0;
		var eLink = 0;
		var temp = "";
		var normal = 0;
		var iMode = 0;
		var found=false;

     		while (responseText!=''){		
			sLink = responseText.search(/src=|href=/i);	
			if ((responseText.charAt(sLink)=="h")||(responseText.charAt(sLink)=="H")) iMode=1
			else iMode=0;
			if ((responseText.substr(sLink+4+iMode,1)=="'")||(responseText.substr(sLink+4+iMode,1)=='"')){
				normal=1;
			}
			else normal=0;
	        	responseText=responseText.substr(sLink+4+iMode+normal);
			if (sLink>-1){
				if (normal==1) {
					eLink = responseText.search(/"|'/i);
				}
				else eLink = responseText.search(/ /i);
				temp = responseText.substring(0,eLink+1);
	        		if (((temp.search(/.jpg/i)>-1)&&(prefs.getBool("jpg")==true))||((temp.search(/.gif/i)>-1)&&(prefs.getBool("gif")==true))||((temp.search(/.png/i)>-1)&&(prefs.getBool("png")==true))) {
					nLinx++;
					linx[nLinx] = '"'+responseText.substring(0,eLink)+'"';
					if ("__UP_lastphoto__"==linx[nLinx].substring(linx[nLinx].indexOf('"')+1,linx[nLinx].lastIndexOf('"'))) { if (found==false){ curLink=nLinx; found=true;}}
				}
	        		responseText=responseText.substr(eLink+1);
			}
			else{
				responseText='';
			}
		}
		if (linx.length>0) removeDuplicates();
		else noImage();
	}


	function noImage(){
		var html='<table id="T1" align="center" width='+(docWidth-5)+' style="border-width:5px; border-style:solid; border-color:#CCCCCC; background-color:#EEEEEE">';
		html+='<tr>';
		html+='<td align="center"><b><font color="#FFFFFF" size="+2">no images found</b></font></td>';
		html+='</tr>';
		html+='</table>';
		document.getElementById('imidz1').innerHTML = html;
		_IG_AdjustIFrameHeight();
	}

	function shiftItems(objNum){
		for (i=curLink;i<linx.length-1;i++) linx[i]=linx[i+1];
		linx.length=linx.length-1;
		if ((curLink>(linx.length-1))||((curLink>0)&&(movingLeft==true))) curLink--;
		if (linx.length==0) noImage();		   
		else displayImage(2);
	}

	function restrictions(obj){
		var accepted=true;
		if ((obj.width<=0) || (obj.height<=0)) accepted=false;
		else{
			var size = obj.width * obj.height;
			if ((size>0)&&(size<=20000)&&(prefs.getBool("small") == false)) accepted=false;
			else if ((size>20000)&&(size<=200000)&&(prefs.getBool("medium") == false)) accepted=false;
			else if ((size>200000)&&(size<=1000000)&&(prefs.getBool("large") == false)) accepted=false;
			else if ((size>1000000)&&(prefs.getBool("xlarge") == false)) accepted=false;
		}
		return accepted;
	}


	function badImage(e){
		if (!e)
		  {
		   window.clearInterval(iVal);
		   shiftItems(curLink);
		  }
	}


        function displayImage(mode){
		var rnd = Math.round((linx.length-1)*Math.random());
		if (prefs.getBool("random") == true){
			while ((rnd==curLink)&&(linx.length-1>0)) rnd = Math.round((linx.length-1)*Math.random());
			curLink=rnd;
		}
		tmpImg = document.createElement('img');
		tmpImg.onerror=badImage;
		if (mode==1) tmpImg.src = "__UP_myphoto__";
		else{	
			if (linx[curLink].substr(1,7)=='http://') tmpImg.src = linx[curLink].substring(linx[curLink].indexOf('"')+1,linx[curLink].lastIndexOf('"'));
			else{
				var s=prefs.getString("myphoto");					
				if (linx[curLink].charAt(1)=='/'){
					s=s.substr(7);
					if (s.indexOf("/")>-1) tmpImg.src = 'http://'+s.substr(0,s.indexOf("/"))+linx[curLink].substring(linx[curLink].indexOf('"')+1,linx[curLink].lastIndexOf('"'));
					else tmpImg.src = 'http://'+s+linx[curLink].substring(linx[curLink].indexOf('"')+1,linx[curLink].lastIndexOf('"'));
				}
				else{
					s=s.substr(7);
					if (s.indexOf("/")>-1) tmpImg.src = 'http://'+s.substr(0,s.lastIndexOf("/")+1)+linx[curLink].substring(linx[curLink].indexOf('"')+1,linx[curLink].lastIndexOf('"'));
					else tmpImg.src = 'http://'+s+'/'+linx[curLink].substring(linx[curLink].indexOf('"')+1,linx[curLink].lastIndexOf('"'));
				}
			}
		}
		iVal=window.setInterval("imageLoaded("+mode+")",1000);
	}

	function imageLoaded(mode){
	     if (mode==2) prefs.set("lastphoto",linx[curLink].substring(linx[curLink].indexOf('"')+1,linx[curLink].lastIndexOf('"')));
	     if (tmpImg.complete){
	       window.clearInterval(iVal);
	       if (restrictions(tmpImg)==false){
			shiftItems(curLink);
	       }else{
		var html = '';
		if (mode==2){
			html='<table id="T1" align="center" onmouseover="fitNavigation()" onmouseout="removeNavigation(event)" width='+(docWidth-5)+' style="border-width:5px; border-style:solid; border-color:#CCCCCC; background-color:#EEEEEE">';
			html+='<tr>';
			if (tmpImg.height<40) html+='<td width='+(docWidth-18)+' height=40 align="center" bgcolor="EEEEEE" style="border-width:1px; border-style:solid; border-color:#CCCCCC; background-color:#EEEEEE">';
			else html+='<td align="center" width='+(docWidth-18)+' style="border-width:1px; border-style:solid; border-color:#CCCCCC; background-color:#EEEEEE">';
        	        html += '<img id="timg" src="'+tmpImg.src+'"';
			if (tmpImg.width>docWidth-25){
				html += ' width=' + (docWidth-25);
			}
			html+='>';
			html+='</td>';
			html+='</tr>';
			html+='</table>';
		}
		else {
			html='<table id="T1" align="center" width='+(docWidth-5)+' border="5" borderColor="#CCCCCC">';
			html+='<tr>';
			html+='<td width='+(docWidth-18)+' align="center" style="border-width:1px; border-style:solid; border-color:#CCCCCC; background-color:#EEEEEE">';
			html+='<IMG SRC="__UP_myphoto__"';
			if (tmpImg.width>docWidth-30){
				html += ' width=' + (docWidth-30);
			}
			html+='>';
			html+='</td>';
			html+='</tr>';
			html+='</table>';
		}
		document.getElementById('imidz1').innerHTML = html;
		_IG_AdjustIFrameHeight();
	       }
	     }
	}


	function start(){
		var temp = "__UP_myphoto__";
		var lead = temp.substr(0,7);
		if ((lead!='http://')&&(lead!='HTTP://')){
			 temp='http://'+temp;
			 prefs.set('myphoto',temp);
		}
		var tip = temp.substr(temp.lastIndexOf(".")+1,3);
		if ((tip=="jpg")||(tip=="gif")||(tip=="png")) displayImage(1);
		else _IG_FetchContent(temp, _IG_Callback(parseDir), { refreshInterval: 1 });
	}


    function goToCanvas() {
      goToView('canvas');
    }

    function goToView(dest) {
      var supported_views = gadgets.views.getSupportedViews();
      gadgets.views.requestNavigateTo(supported_views[dest]);
    }

   </script>

<table cellspacing="0" cellpadding="0" width="100%" bgcolor="white" class="regular">
<tr style="font-family:Arial; font-size:11pt;">
  <td>
    <a href="http://www.adapta-solutions.com/solutions/gadgets.html" target="_blank" onmouseover="document.m1.src ='http://www.meteo-si.com/images/kroglice2.gif';" onmouseout="document.m1.src ='http://www.meteo-si.com/images/kroglice.gif';"><img border="0" src="http://www.meteo-si.com/images/kroglice.gif" name="m1"> More gadgets</a>
  </td>
  <td align="right">
    <a onclick="goToCanvas();" style="cursor:pointer">More options</a>
  </td>
</tr>
</table>

   <div id="imidz1"></div>

<script type="text/javascript">
// Get a reference to user preferences
var prefs = new _IG_Prefs();
// Get the user's current date/time
var now = new Date();
// Create a date string of the form yyyy-m-d
var today = (now.getFullYear?now.getFullYear():now.getYear())+'-'+(now.getMonth()+1)+'-'+now.getDate();
// Get the stored value of the "today" user preference.
var prefs_today = prefs.getString('today');

// If the "today" user preference is blank, then the user has never loaded
// this gadget. They must have just added it!
if (prefs_today=='') {
    _IG_Analytics("UA-6660391-1", "/novigadget/pic/our-picoftheday");
}
// If the generated date string doesn't match the one stored in the
// preferences, then this is the first time the user has loaded the
// gadget today. Record a hit and change the preferernce to be
// today's date string so it won't get recorded again.
if (prefs_today!=today) {
    prefs.set('today',today);
    _IG_Analytics("UA-6660391-1", "/gadget/pic/our-picoftheday");
}
</script>


</body>
</html>
]]>
</Content>
<Content type="html" view="canvas">
<![CDATA[

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<SCRIPT language="JavaScript">
<!--
//-->
</SCRIPT>
</head>
<body bgcolor="#EEEEEE" onload="start()">

   <script type="text/javascript">

	var linx = new Array();
	var tmpImg;
	var imgs = new Array();
	var imgLinx = new Array();
        var firstLink = 0;
	var curLink = 0;
	var t = new Array();
	var docWidth= document.body.clientWidth-170;
	var line = Math.round((docWidth-10)/100);
	var lineBup = Math.round((docWidth-10)/100);
	var iVal, iVal1, iVal2, iDone = "";
	var prefs = new _IG_Prefs();
	var imgCount;
        var duplicating=false;
	var counter=0;
	var curImg=0;
	var boxes=0;


	function crop(img_id, crop_id, x, y, width, height) {

		var style = img_id.style; 
                var styleC = crop_id.style;
		var scale_x = img_id.width / width;
		var scale_y = img_id.height / height;

		styleC.position = 'relative';
		styleC.overflow = 'hidden';

		style.position = "absolute"; 
		style.display = "block";
		style.left = (-x * scale_x) + 'px';
    		style.top = (-y * scale_y) + 'px';
		style.width = (img_id.width * scale_x) + 'px';
		style.height = (img_id.height * scale_y) + 'px';
		style.border = "#FFFFFF";
		style.borderWidth = "8px"

		crop_id.appendChild(img_id);

	}

	function removeI(j){
		if ((curLink>j-1)&&(curLink>0)) curLink--;
		for (i=j;i<linx.length-1;i++) linx[i]=linx[i+1];
		linx.length=linx.length-1;
		if (j>(linx.length-1)) curImg--;
	}

	function removeDuplicates(){
		duplicating=true;
		var i=0;
		var j=1;
		while (i<linx.length-1){
			if (linx[i]==linx[j]) removeI(j);
			else j++;
			if (j>linx.length-1) {
				i++;
				j=i+1;
			}
		}
		duplicating=false;
		displayImage(2);
		displayLinx();
	}


	function parseDir(responseText) {
		var nLinx = -1;        
		var sLink = 0;
		var eLink = 0;
		var temp = "";
		var normal = 0;
		var iMode = 0;
		var found=false;

     		while (responseText!=''){		
			sLink = responseText.search(/src=|href=/i);	
			if ((responseText.charAt(sLink)=="h")||(responseText.charAt(sLink)=="H")) iMode=1
			else iMode=0;
			if ((responseText.substr(sLink+4+iMode,1)=="'")||(responseText.substr(sLink+4+iMode,1)=='"')){
				normal=1;
			}
			else normal=0;
	        	responseText=responseText.substr(sLink+4+iMode+normal);
			if (sLink>-1){
				if (normal==1) {
					eLink = responseText.search(/"|'/i);
				}
				else eLink = responseText.search(/ /i);
				temp = responseText.substring(0,eLink+1);
	        		if (((temp.search(/.jpg/i)>-1)&&(prefs.getBool("jpg")==true))||((temp.search(/.gif/i)>-1)&&(prefs.getBool("gif")==true))||((temp.search(/.png/i)>-1)&&(prefs.getBool("png")==true))) {
					nLinx++;
					linx[nLinx] = '"'+responseText.substring(0,eLink)+'"';
					if ("__UP_lastphoto__"==linx[nLinx].substring(linx[nLinx].indexOf('"')+1,linx[nLinx].lastIndexOf('"'))) { if (found==false){ curLink=nLinx; found=true;}}
				}
	        		responseText=responseText.substr(eLink+1);
			}
			else{
				responseText='';
			}
		}
		if (linx.length>0) removeDuplicates();
		else noImage();
	}


	function waitForUpdate(){
		if (imgs[curLink].complete){
				showImage(curLink);
				window.clearInterval(iVal1);
		}
	}


	function nextImage(obj){
                var tImg=document.getElementById('next'+obj);
		tImg.src="http://www.meteo-si.com/pic/our-picoftheday/right.gif";
		iVal1=window.setInterval("nextImage1("+obj+")",300);
	}	

	function nextImage1(obj){
		if (document.getElementById('next'+obj).complete){
			window.clearInterval(iVal1);
			if (prefs.getBool("random") == true){
				displayImage(2);
			}		
			else if (curLink<linx.length-1){
				curLink++;
				displayImage(2);
			}
			else document.getElementById('next'+obj).src="http://www.meteo-si.com/pic/our-picoftheday/right-shadow.gif"
		}
	}

	function prevImage(obj){
                var tImg=document.getElementById('prev'+obj);
		tImg.src="http://www.meteo-si.com/pic/our-picoftheday/left.gif";
		iVal1=window.setInterval("prevImage1("+obj+")",300);
	}	

	function prevImage1(obj){
		if (document.getElementById('prev'+obj).complete){
			window.clearInterval(iVal1);
			if (prefs.getBool("random") == true){
				displayImage(2);
			}		
			else if (curLink>0){
				curLink--;
				displayImage(2);
			}
			else document.getElementById('prev'+obj).src="http://www.meteo-si.com/pic/our-picoftheday/left-shadow.gif"
		}
	}


	function ImageDone(imgID){
		var im=document.getElementById(imgID);
		if (im.complete){
			window.clearInterval(iDone);
			_IG_AdjustIFrameHeight();
		}
	}

        function mainNavigation(){	
		var html='<table align ="left" width='+docWidth+' style="border-width:2px; border-style:inset; border-color:#CCCCCC; background-color:#CCCCCC">';
		html+='<td width=100 align="left" onclick="prevImage(0)">';
		html+='<img id="prev0" src="http://www.meteo-si.com/pic/our-picoftheday/left-shadow.gif">';
		html+='</td>';
		html+='<td width='+(document.width-210)+' align="center"><b><font color="#FFFFFF" size="+2">('+(curLink+1)+' of '+linx.length+')</b></font></td>';
		html+='<td width=100 align="right" onclick="nextImage(0)">';
		html+='<img id="next0" src="http://www.meteo-si.com/pic/our-picoftheday/right-shadow.gif">';
		html+='</td>';
		html+='</table>';
		var html1='<table align ="left" width='+docWidth+' style="border-width:2px; border-style:inset; border-color:#CCCCCC; background-color:#CCCCCC">';
		html1+='<td width=100 align="left" onclick="prevImage(1)">';
		html1+='<img id="prev1" src="http://www.meteo-si.com/pic/our-picoftheday/left-shadow.gif">';
		html1+='</td>';
		html1+='<td width='+(document.width-210)+' align="center"><b><font color="#FFFFFF" size="+2">('+(curLink+1)+' of '+linx.length+')</b></font></td>';
		html1+='<td width=100 align="right" onclick="nextImage(1)">';
		html1+='<img id="next1" src="http://www.meteo-si.com/pic/our-picoftheday/right-shadow.gif">';
		html1+='</td>';
		html1+='</table>';
		document.getElementById('navigation').innerHTML = html;
		document.getElementById('navigation2').innerHTML = html1;
		iDone=window.setInterval("ImageDone('timg')",200);
	}

	function noImage(){
		var html='<table align ="left" width='+docWidth+' style="border-width:2px; border-style:inset; border-color:#CCCCCC; background-color:#CCCCCC">';
		html+='<td align="center"><b><font color="#FFFFFF" size="+2">no images found</b></font></td>';
		html+='</table>';
		document.getElementById('navigation').innerHTML = html;
		document.getElementById('navigation2').innerHTML = html;
		html='<table width='+docWidth+' border="5" borderColor="#CCCCCC">';
		html+='<tr>';
		html+='<td align="center"  style="border-width:1px; border-style:solid; border-color:#CCCCCC; background-color:#EEEEEE"></td></tr>';
		document.getElementById('imidz').innerHTML = html;
		if (prefs.getBool("thumbnails") == true) document.getElementById('thumbs').innerHTML = "";
		_IG_AdjustIFrameHeight();
	}

        function showImage(item){
		window.clearInterval(iVal);
		curLink=item+firstLink;		
		tmpImg = document.createElement('img');
		tmpImg.src=imgs[item].src;
		iVal=window.setInterval("imageLoaded(2)",200);
	}


        function displayImage(mode){
		var rnd = Math.round((linx.length-1)*Math.random());
		if (prefs.getBool("random") == true){
			while ((rnd==curLink)&&(linx.length-1>0)) rnd = Math.round((linx.length-1)*Math.random());
			curLink=rnd;
		}
		tmpImg = document.createElement('img');
		if (mode==1) tmpImg.src = "__UP_myphoto__";
		else{
			if (linx[curLink].substr(1,7)=='http://') tmpImg.src = linx[curLink].substring(linx[curLink].indexOf('"')+1,linx[curLink].lastIndexOf('"'));
			else{
				var s=prefs.getString("myphoto");					
				if (linx[curLink].charAt(1)=='/'){
					s=s.substr(7);
					if (s.indexOf("/")>-1) tmpImg.src = 'http://'+s.substr(0,s.indexOf("/"))+linx[curLink].substring(linx[curLink].indexOf('"')+1,linx[curLink].lastIndexOf('"'));
					else tmpImg.src = 'http://'+s+linx[curLink].substring(linx[curLink].indexOf('"')+1,linx[curLink].lastIndexOf('"'));
				}
				else{
					s=s.substr(7);
					if (s.indexOf("/")>-1) tmpImg.src = 'http://'+s.substr(0,s.lastIndexOf("/")+1)+linx[curLink].substring(linx[curLink].indexOf('"')+1,linx[curLink].lastIndexOf('"'));
					else tmpImg.src = 'http://'+s+'/'+linx[curLink].substring(linx[curLink].indexOf('"')+1,linx[curLink].lastIndexOf('"'));
				}
			}
		}
		window.clearInterval(iVal);
		iVal=window.setInterval("imageLoaded("+mode+")",1000);
	}

	function imageLoaded(mode){
	     if (mode==2) prefs.set("lastphoto",linx[curLink].substring(linx[curLink].indexOf('"')+1,linx[curLink].lastIndexOf('"')));
	     if (tmpImg.complete){
	       window.clearInterval(iVal);
	       if (restrictions(tmpImg)==false){
			curLink=0;
			displayImage(2);
	       }else{
		var html = '';
		if (mode==2){
			html='<table width='+docWidth+' border="5" borderColor="#CCCCCC">';
			html+='<tr>';
			html+='<td align="center"  style="border-width:1px; border-style:solid; border-color:#CCCCCC; background-color:#EEEEEE">';
        	        html += '<img id="timg" src="'+tmpImg.src+'"';
			if (tmpImg.width>docWidth){
				html += ' WIDTH=' + (docWidth-30);
			}
			html+='>';
			html+='</td>';
			html+='</tr>';
			html+='</table>';
		}
		else {
			html='<table width='+docWidth+' border="5" borderColor="#CCCCCC">';
			html+='<tr>';
			html+='<td align="center"  style="border-width:1px; border-style:solid; border-color:#CCCCCC; background-color:#EEEEEE">';
			html+='<IMG SRC="__UP_myphoto__"';
			if (tmpImg.width>docWidth){
				html += ' WIDTH=' + (docWidth-30);
			}
			html+= '>';
			html+='</td>';
			html+='</tr>';
			html+='</table>';
		}
	        document.getElementById('imidz').innerHTML = html;
	        if (mode==2) mainNavigation();
	       }
	     }
	}

	function shiftItems(objNum){
		if (firstLink+objNum==curLink) curLink=0;
		removeI(firstLink+objNum);
		if (linx.length==0) noImage();
		else if ((objNum>0) && (firstLink+objNum<linx.length)){displayImage(2); fixLinx();}
		else displayLinx();
	}

	function restrictions(obj){
		var accepted=true;
		if ((obj.width<=0) || (obj.height<=0)) accepted=false;
		else{
			var size = obj.width * obj.height;
			if ((size>0)&&(size<=20000)&&(prefs.getBool("small") == false)) accepted=false;
			else if ((size>20000)&&(size<=200000)&&(prefs.getBool("medium") == false)) accepted=false;
			else if ((size>200000)&&(size<=1000000)&&(prefs.getBool("large") == false)) accepted=false;
			else if ((size>1000000)&&(prefs.getBool("xlarge") == false)) accepted=false;
		}
		return accepted;
	}

	function checkImage(objNum){
		if (imgs[objNum].complete){
		   window.clearInterval(t[objNum]);
		   if (restrictions(imgs[objNum])==false) shiftItems(objNum);
		   else{
			if (imgs[objNum].width>imgs[objNum].height){
				var fact=imgs[objNum].height/75;
				var x=((imgs[objNum].width/fact)-75)*(fact/2);
				crop(imgs[objNum], document.getElementById("crop"+objNum), x, 1, imgs[objNum].width*fact, imgs[objNum].height*fact);
			}
			else{
				var fact=imgs[objNum].width/75;
				var y=((imgs[objNum].height/fact)-75)*(fact/2);
				crop(imgs[objNum], document.getElementById("crop"+objNum), 1, y, imgs[objNum].width*fact, imgs[objNum].height*fact);
			}
			if (objNum<imgCount){				
				objNum++;
				curImg=objNum;
				imgs[objNum].src=imgLinx[objNum];
				 t[objNum]=window.setInterval("checkImage("+objNum+")",200);
			}
		   }
		}
	}

	function badImage(e){
		var targ;
		var objNum=curImg;
		if (!e)
		  {
		   window.clearInterval(t[objNum]);
		   shiftItems(objNum);
		  }
	}


	function deleteBoxes(){
		var table = document.getElementById('T1');
		var fix=false;
		for (i=imgCount;i<=boxes;i++){
			fix=true;
			table.removeChild(table.lastChild);
		}
		if (fix==true) {
			var el = document.createElement('TD');
			table.appendChild(el);	
		}
		boxes=imgCount;
	}

	function fixLinx(){
		for (j=firstLink+curImg,i=curImg;((j<linx.length)&&(j<firstLink+line));j++,i++){
			if (linx[j].substr(1,7)=='http://') imgLinx[i] = linx[j].substring(linx[j].indexOf('"')+1,linx[j].lastIndexOf('"'));
			else{
				var s=prefs.getString("myphoto");					
				if (linx[j].charAt(1)=='/'){
					s=s.substr(7);
					if (s.indexOf("/")>-1) imgLinx[i] = 'http://'+s.substr(0,s.indexOf("/"))+linx[j].substring(linx[j].indexOf('"')+1,linx[j].lastIndexOf('"'));
					else imgLinx[i] = 'http://'+s+linx[j].substring(linx[j].indexOf('"')+1,linx[j].lastIndexOf('"'));
				}
				else{
					s=s.substr(7);
					if (s.indexOf("/")>-1) imgLinx[i] = 'http://'+s.substr(0,s.lastIndexOf("/")+1)+linx[j].substring(linx[j].indexOf('"')+1,linx[j].lastIndexOf('"'));
					else imgLinx[i] = 'http://'+s+'/'+linx[j].substring(linx[j].indexOf('"')+1,linx[j].lastIndexOf('"'));
				}
			}
			imgCount=i;
		}		
		if (imgCount<boxes) deleteBoxes();
		imgs[curImg] = document.createElement('img');
		imgs[curImg].onerror = badImage;
		imgs[curImg].setAttribute('id','img'+i);
		imgs[curImg].src=imgLinx[curImg];
		t[curImg]=window.setInterval("checkImage("+curImg+")",200);
	}

	function displayLinx(){
		var html='<table width="'+docWidth+'" bgcolor="#EEEEEE" align="left" style="border:1px solid #CCCCCC">';
		html+='<tr id="T1">';
		if (firstLink>0){
			line=lineBup+0;
			html+='<td border="0" onclick="moveLeft()" width="'+Math.round((docWidth-(line*90))/2)+'">';
			html+='<img id="NL" style="cursor:pointer;" src="http://www.meteo-si.com/pic/our-picoftheday/double-left-shaddow.gif">';
			html+='</td>';
		}
		else line=lineBup+1;

		while (firstLink>=linx.length) firstLink--;
		for (j=firstLink,i=0;((j<linx.length)&&(j<firstLink+line));j++,i++){
			html+='<td border="0" width=85 onmouseover="changeBorder('+i+')" onmouseout="changeBorderBack('+i+')">'; 
			html += '<div id="crop'+i+'" onclick="showImage('+i+')" style="cursor:pointer; width:75px; height:75px; border-width:4px; border-style:inset; border-color:#FFFFFF;"></div>';
			imgs[i] = document.createElement('img');
			imgs[i].onerror = badImage;
			imgs[i].setAttribute('id','img'+i);
			if (linx[j].substr(1,7)=='http://') imgLinx[i] = linx[j].substring(linx[j].indexOf('"')+1,linx[j].lastIndexOf('"'));
			else{
				var s=prefs.getString("myphoto");					
				if (linx[j].charAt(1)=='/'){
					s=s.substr(7);
					if (s.indexOf("/")>-1) imgLinx[i] = 'http://'+s.substr(0,s.indexOf("/"))+linx[j].substring(linx[j].indexOf('"')+1,linx[j].lastIndexOf('"'));
					else imgLinx[i] = 'http://'+s+linx[j].substring(linx[j].indexOf('"')+1,linx[j].lastIndexOf('"'));
				}
				else{
					s=s.substr(7);
					if (s.indexOf("/")>-1) imgLinx[i] = 'http://'+s.substr(0,s.lastIndexOf("/")+1)+linx[j].substring(linx[j].indexOf('"')+1,linx[j].lastIndexOf('"'));
					else imgLinx[i] = 'http://'+s+'/'+linx[j].substring(linx[j].indexOf('"')+1,linx[j].lastIndexOf('"'));
				}
			}
			html+='</td>';
			imgCount=i;
		}
		boxes=imgCount;
		curImg=0;
		imgs[0].src=imgLinx[0];
		t[0]=window.setInterval("checkImage(0)",200);
		

		if (firstLink+line<linx.length){
			html+='<td border="0" align="right" onclick="moveRight()">';
			html+='<img id="NR" style="cursor:pointer;" src="http://www.meteo-si.com/pic/our-picoftheday/double-right-shaddow.gif">';
			html+='</td>';
		}
		else html+='<td></td>';
		html+='</tr>'
		html+='</table>';
	        if (prefs.getBool("thumbnails") == true) document.getElementById('thumbs').innerHTML = html;
	}

	function changeBorder(objNum){
		var style = document.getElementById('crop'+objNum).style;
		style.borderColor="#FF0000";
	}

	function changeBorderBack(objNum){
		var style = document.getElementById('crop'+objNum).style;
		style.borderColor="#FFFFFF";
	}


	function moveLeft(){
		window.clearInterval(t[curImg]);
                var tImg=document.getElementById('NL');
		tImg.src="http://www.meteo-si.com/pic/our-picoftheday/double-left.gif";
		iVal2=window.setInterval("moveLeft1()",300);
	}

	function moveLeft1(){
		if (document.getElementById('NL').complete){
			window.clearInterval(iVal2);
			if (firstLink>0){
				firstLink-=line;
				if (firstLink==1) firstLink=0;
				displayLinx();
			}
		}	
	}

	function moveRight(){
		window.clearInterval(t[curImg]);
                var tImg=document.getElementById('NR');
		tImg.src="http://www.meteo-si.com/pic/our-picoftheday/double-right.gif";
		iVal2=window.setInterval("moveRight1()",300);
	}

	function moveRight1(){
		if (document.getElementById('NR').complete){
			window.clearInterval(iVal2);
			if (firstLink+line<linx.length){				
				firstLink+=line;
				displayLinx();
			}
		}
	}

	function start(){
		var temp = "__UP_myphoto__";
		var lead = temp.substr(0,7);
		if ((lead!='http://')&&(lead!='HTTP://')){
			 temp='http://'+temp;
			 prefs.set('myphoto',temp);
		}
		var tip = temp.substr(temp.lastIndexOf(".")+1,3);
		if ((tip=="jpg")||(tip=="gif")||(tip=="png")) displayImage(1);
//		else _IG_FetchContent(temp, _IG_Callback(parseDir), { refreshInterval: 1 });
		else _IG_FetchContent(temp, _IG_Callback(parseDir));
 
	}

//http://ankitchaturvedi.blogspot.com/2008/04/reuters-top-photos.html

   </script>


<table cellspacing="0" cellpadding="0" width="100%" bgcolor="white" border=1 class="regular">
<tr><td>
  <table cellspacing="0" cellpadding="0" width="100%" bgcolor="white" class="regular">
   <tr>
    <td style="font-family:Arial; font-size:11pt;">
      <a href="http://www.adapta-solutions.com/solutions/gadgets.html" target="_blank" onmouseover="document.m1.src ='http://www.meteo-si.com/images/kroglice2.gif';" onmouseout="document.m1.src ='http://www.meteo-si.com/images/kroglice.gif';"><img border="0" src="http://www.meteo-si.com/images/kroglice.gif" name="m1"> More gadgets</a>
    </td>    
   </tr>
  </table>
</td>
<td width="170px" style="font-family:Arial; font-size:11pt;">
More options
</td></tr>
<tr><td valign="top">
   <table bgcolor="#EEEEEE" style="border:1px solid #CCCCCC">
   <tr>
   <td>
   <div id="thumbs" align="left"></div>
   </td>
   </tr>
   <tr>
   <td>
   <div id='navigation'></div>
   </td>
   </tr>
   <tr>
   <td>
   <div id="imidz"></div>
   </td>
   </tr>
   <tr>
   <td>
   <div id='navigation2'></div>
   </td>
   </tr>
   </table>
</td>
<td valign="top" style="font-family:arial; font-size:11pt;">
<div id="menuhelpdiv"><a onclick="showhelp();">Help</a></div>
<a href="http://www.adapta-solutions.com/solutions/gadgets.html" target="_blank">More gadgets</a><br>
<a href="http://www.google.com/ig/directory?url=www.meteo-si.com/pic/our-picoftheday.xml" target="_blank">About this gadget</a><br>
<br>
Country editions<br>
<a href="http://fusion.google.com/ig/add?synd=open&amp;source=ggyp&amp;moduleurl=http://www.meteo-si.com/meteo-USA.xml" target="_blank"><img border="0" src="http://www.meteo-si.com/images/google_icon.gif"> Meteo-USA</a><br>
<a href="http://fusion.google.com/ig/add?synd=open&amp;source=ggyp&amp;moduleurl=http://www.meteo-si.com/meteo-CA.xml" target="_blank"><img border="0" src="http://www.meteo-si.com/images/google_icon.gif"> Meteo-CA</a><br>
<a href="http://fusion.google.com/ig/add?synd=open&amp;source=ggyp&amp;moduleurl=http://www.meteo-si.com/meteo-UK.xml" target="_blank"><img border="0" src="http://www.meteo-si.com/images/google_icon.gif"> Meteo-UK</a><br>
Space Weather<br>
<a href="http://fusion.google.com/ig/add?synd=open&amp;source=ggyp&amp;moduleurl=http://www.meteo-si.com/moon/moon.xml" target="_blank"><img border="0" src="http://www.meteo-si.com/images/google_icon.gif"> Moon</a><br>
<a href="http://fusion.google.com/ig/add?synd=open&amp;source=ggyp&amp;moduleurl=http://www.meteo-si.com/space/sun.xml" target="_blank"><img border="0" src="http://www.meteo-si.com/images/google_icon.gif"> Sun</a><br>
<a href="http://fusion.google.com/ig/add?synd=open&amp;source=ggyp&amp;moduleurl=http://www.meteo-si.com/space/mercury.xml" target="_blank"><img border="0" src="http://www.meteo-si.com/images/google_icon.gif"> Mercury</a><br>
<a href="http://fusion.google.com/ig/add?synd=open&amp;source=ggyp&amp;moduleurl=http://www.meteo-si.com/space/venus.xml" target="_blank"><img border="0" src="http://www.meteo-si.com/images/google_icon.gif"> Venus</a><br>
<a href="http://fusion.google.com/ig/add?synd=open&amp;source=ggyp&amp;moduleurl=http://www.meteo-si.com/space/mars.xml" target="_blank"><img border="0" src="http://www.meteo-si.com/images/google_icon.gif"> Mars</a><br>
<a href="http://fusion.google.com/ig/add?synd=open&amp;source=ggyp&amp;moduleurl=http://www.meteo-si.com/space/jupiter.xml" target="_blank"><img border="0" src="http://www.meteo-si.com/images/google_icon.gif"> Jupiter</a><br>
<a href="http://fusion.google.com/ig/add?synd=open&amp;source=ggyp&amp;moduleurl=http://www.meteo-si.com/space/saturn.xml" target="_blank"><img border="0" src="http://www.meteo-si.com/images/google_icon.gif"> Saturn</a><br>
<a href="http://fusion.google.com/ig/add?synd=open&amp;source=ggyp&amp;moduleurl=http://www.meteo-si.com/space/uranus.xml" target="_blank"><img border="0" src="http://www.meteo-si.com/images/google_icon.gif"> Uranus</a><br>
<a href="http://fusion.google.com/ig/add?synd=open&amp;source=ggyp&amp;moduleurl=http://www.meteo-si.com/space/neptune.xml" target="_blank"><img border="0" src="http://www.meteo-si.com/images/google_icon.gif"> Neptune</a><br>
</td></tr>
</table>

  <script type="text/javascript">
// Get a reference to user preferences
var prefs = new _IG_Prefs();
// Get the user's current date/time
var now = new Date();
// Create a date string of the form yyyy-m-d
var today = (now.getFullYear?now.getFullYear():now.getYear())+'-'+(now.getMonth()+1)+'-'+now.getDate();
// Get the stored value of the "today" user preference.
var prefs_today = prefs.getString('today');

// If the "today" user preference is blank, then the user has never loaded
// this gadget. They must have just added it!
if (prefs_today=='') {
    _IG_Analytics("UA-6660391-1", "/novigadget/pic/our-picoftheday");
}
// If the generated date string doesn't match the one stored in the
// preferences, then this is the first time the user has loaded the
// gadget today. Record a hit and change the preferernce to be
// today's date string so it won't get recorded again.
if (prefs_today!=today) {
    prefs.set('today',today);
    _IG_Analytics("UA-6660391-1", "/gadget/pic/our-picoftheday");
}
</script>

</body>
</html>

]]>
</Content>
</Module>

