function loading(){ 


var tar = "";
var userAgenty_var = "";
    userAgenty_var = System.Gadget.Settings.read("userAgenty");
    //confirm(userAgenty_var);

var win = System.Gadget.Settings.read("win");
if(win == 'vista'){
if(userAgenty_var == false)
{
document.body.style.height = "320px";
tar="<div id='userAgenty1'><div id='userA1'><input type='checkbox' name='userAgenty' id='userAgenty' value='0'></div><div id='userA2'>"+lang.userAgent+"</div></div>";
}else{
document.body.style.height = "300px";
tar="<div id='userAgenty1'><div id='userA1'><input type='checkbox' name='userAgenty' id='userAgenty' value='0' checked></div><div id='userA2'>"+lang.userAgent+"</div></div>";
}
}

var s = "";
var styley_var = "";
    styley_var = System.Gadget.Settings.read("styley");
if(styley_var == '1')
{
s  = "<div id='styley1'><div id='sty1'><input type='radio' name='styley' onclick='styley(\"1\");' value='1' checked></div><div id='sty2'><img src='img/m1/28.png'></div>";
s += "<div id='sty3'><input type='radio' name='styley' onclick='styley(\"2\");' value='2'></div><div id='sty4'><img src='img/m2/28.png'></div></div>";
}else{
s  = "<div id='styley1'><div id='sty1'><input type='radio' name='styley' onclick='styley(\"1\");' value='1'></div><div id='sty2'><img src='img/m1/28.png'></div>";
s += "<div id='sty3'><input type='radio' name='styley' onclick='styley(\"2\");' value='2' checked></div><div id='sty4'><img src='img/m2/28.png'></div></div>";    
}


var gg = "";
var confirmy_var = "";
    confirmy_var = System.Gadget.Settings.read("confirmy");
if(confirmy_var == false)
{
gg="<div id='alert' style='display:none'><div id='al1'><input type='checkbox' name='confirmy' id='confirmy' value='0'></div><div id='al2'>"+lang.alert+"</div></div>";
}else{
gg="<div id='alert' style='display:none'><div id='al1'><input type='checkbox' name='confirmy' id='confirmy' value='0' checked></div><div id='al2'>"+lang.alert+"</div></div>";
}


var e = "";
var CF_var = "";
    CF_var = System.Gadget.Settings.read("grad");

if(CF_var == 'F')
{
e = "<div id='cf1'><div id='cf_radio'><input type='radio' name='cf' onclick='CF(\"C\");' value='C'></div><div id='cf_image'>"+lang.cf+"</div></div>";
e += "<div id='cf2'><div id='cf_radio'><input type='radio' name='cf' onclick='CF(\"F\");' value='F' checked></div><div id='cf_image'>"+lang.ff+"</div></div>";
}else{
e = "<div id='cf1'><div id='cf_radio'><input type='radio' name='cf' onclick='CF(\"C\");' value='C' checked></div><div id='cf_image'>"+lang.cf+"</div></div>";
e += "<div id='cf2'><div id='cf_radio'><input type='radio' name='cf' onclick='CF(\"F\");' value='F'></div><div id='cf_image'>"+lang.ff+"</div></div>";
}


var d = "";
var style_var = "";
    style_var = System.Gadget.Settings.read("style");

d = style_var;
if(style_var == 'c')
{
d = "<div style='padding-top: 8px;'><div id='c01'><div id='c_radio'><input type='radio' name='style' onclick='st(\"c\");' value='c' checked></div><div id='c_image'><img src='../img/c.png'></div></div>";
d += "<div id='c02'><div id='c_radio'><input type='radio' name='style' onclick='st(\"w\");' value='w'></div><div id='c_image'><img src='../img/w.png'></div></div>";
d += "<div id='c03'><div id='c_radio'><input type='radio' name='style' onclick='st(\"b\");' value='b' ></div><div id='c_image'><img src='../img/b.png'></div></div>";
d += "<div id='c04'><div id='c_radio'><input type='radio' name='style' onclick='st(\"blue\");' value='blue' ></div><div id='c_image'><img src='../img/blue.png'></div></div>";
d += "<div id='c05'><div id='c_radio'><input type='radio' name='style' onclick='st(\"r\");' value='r' ></div><div id='c_image'><img src='../img/r.png'></div></div>";
d += "</div>";
}
else if(style_var == 'w')
{
d = "<div style='padding-top: 8px;'><div id='c01'><div id='c_radio'><input type='radio' name='style' onclick='st(\"c\");' value='c'></div><div id='c_image'><img src='../img/c.png'></div></div>";
d += "<div id='c02'><div id='c_radio'><input type='radio' name='style' onclick='st(\"w\");' value='w' checked></div><div id='c_image'><img src='../img/w.png'></div></div>";
d += "<div id='c03'><div id='c_radio'><input type='radio' name='style' onclick='st(\"b\");' value='b' ></div><div id='c_image'><img src='../img/b.png'></div></div>";
d += "<div id='c04'><div id='c_radio'><input type='radio' name='style' onclick='st(\"blue\");' value='blue' ></div><div id='c_image'><img src='../img/blue.png'></div></div>";
d += "<div id='c05'><div id='c_radio'><input type='radio' name='style' onclick='st(\"r\");' value='r' ></div><div id='c_image'><img src='../img/r.png'></div></div>";
d += "</div>";
}
else if(style_var == 'blue')
{
d = "<div style='padding-top: 8px;'><div id='c01'><div id='c_radio'><input type='radio' name='style' onclick='st(\"c\");' value='c'></div><div id='c_image'><img src='../img/c.png'></div></div>";
d += "<div id='c02'><div id='c_radio'><input type='radio' name='style' onclick='st(\"w\");' value='w'></div><div id='c_image'><img src='../img/w.png'></div></div>";
d += "<div id='c03'><div id='c_radio'><input type='radio' name='style' onclick='st(\"b\");' value='b' ></div><div id='c_image'><img src='../img/b.png'></div></div>";
d += "<div id='c04'><div id='c_radio'><input type='radio' name='style' onclick='st(\"blue\");' value='blue' checked></div><div id='c_image'><img src='../img/blue.png'></div></div>";
d += "<div id='c05'><div id='c_radio'><input type='radio' name='style' onclick='st(\"r\");' value='r' ></div><div id='c_image'><img src='../img/r.png'></div></div>";
d += "</div>";
}
else if(style_var == 'r')
{
d = "<div style='padding-top: 8px;'><div id='c01'><div id='c_radio'><input type='radio' name='style' onclick='st(\"c\");' value='c'></div><div id='c_image'><img src='../img/c.png'></div></div>";
d += "<div id='c02'><div id='c_radio'><input type='radio' name='style' onclick='st(\"w\");' value='w'></div><div id='c_image'><img src='../img/w.png'></div></div>";
d += "<div id='c03'><div id='c_radio'><input type='radio' name='style' onclick='st(\"b\");' value='b' ></div><div id='c_image'><img src='../img/b.png'></div></div>";
d += "<div id='c04'><div id='c_radio'><input type='radio' name='style' onclick='st(\"blue\");' value='blue' ></div><div id='c_image'><img src='../img/blue.png'></div></div>";
d += "<div id='c05'><div id='c_radio'><input type='radio' name='style' onclick='st(\"r\");' value='r' checked></div><div id='c_image'><img src='../img/r.png'></div></div>";
d += "</div>";
}
else
{
d = "<div style='padding-top: 8px;'><div id='c01'><div id='c_radio'><input type='radio' name='style' onclick='st(\"c\");' value='c'></div><div id='c_image'><img src='../img/c.png'></div></div>";
d += "<div id='c02'><div id='c_radio'><input type='radio' name='style' onclick='st(\"w\");' value='w'></div><div id='c_image'><img src='../img/w.png'></div></div>";
d += "<div id='c03'><div id='c_radio'><input type='radio' name='style' onclick='st(\"b\");' value='b' checked></div><div id='c_image'><img src='../img/b.png'></div></div>";
d += "<div id='c04'><div id='c_radio'><input type='radio' name='style' onclick='st(\"blue\");' value='blue' ></div><div id='c_image'><img src='../img/blue.png'></div></div>";
d += "<div id='c05'><div id='c_radio'><input type='radio' name='style' onclick='st(\"r\");' value='r' ></div><div id='c_image'><img src='../img/r.png'></div></div>";
d += "</div>";
}

   var show  = "";
       show  = System.Gadget.Settings.read("ortname");
       show  = show.toString();
   var hello = "";
       if(show == ''){hello = lang.hello;}else{hello = lang.hello2;}

document.getElementById("txt1").innerHTML = '<div>';

document.getElementById("txt1").innerHTML += '<div id="ortaktuell" ><!--<b>'+lang.setstadt+':</b> --><span id="now">'+System.Gadget.Settings.read("shortort")+' ('+System.Gadget.Settings.read("ortname")+')</span> <a href="javascript:showstadt(\'\');">'+lang.setaendern+'</a></div>';


document.getElementById("txt1").innerHTML += '<div id="ortinput" style="display:none;"><table border="0" cellpadding="1" cellspacing="1"><tr><td valign="top"><input id="show" class="box" type="text" name="show" value="'+show+'"></td><td valign="top"><a href="javascript:search();" class="btn black">'+lang.setsearch+'</a></td></tr></table></div>';


document.getElementById("txt1").innerHTML += '<div id="erg" style="display:none;"></div>';

document.getElementById("txt1").innerHTML += '<div class="topic2" id="a1">'+lang.topic2_1+'</div>';
document.getElementById("txt1").innerHTML += '<div id="a2">'+d+'</div>';
document.getElementById("txt1").innerHTML += '<div id="a3">'+s+'</div>';

document.getElementById("txt1").innerHTML += '<div class="topic3" id="a4">'+lang.topic2_2+'</div>';
document.getElementById("txt1").innerHTML += '<div id="a5">'+e+'</div>';
document.getElementById("txt1").innerHTML += '<div id="a6">'+gg+'</div>';
document.getElementById("txt1").innerHTML += '<div id="a7">'+tar+'</div>';


document.getElementById("txt1").innerHTML += '<div class="top20 bottom-15" id="a8"><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4149245" class="btn black">'+lang.donate+'</a></div>';document.getElementById("txt1").innerHTML += '</div>';
}


function navigation(id)
{
   document.getElementById('nav1').className = "deaktiv";
   document.getElementById('nav2').className = "deaktiv";
   document.getElementById('nav3').className = "deaktiv";
   document.getElementById('nav'+id).className = "aktiv";
   document.getElementById('content1').style.display   = "none";
   document.getElementById('content2').style.display   = "none";
   document.getElementById('content3').style.display   = "none";
   document.getElementById('content'+id).style.display = "block";
}





function close() {
   closeAction();
} 
function CF(CF)
{
System.Gadget.Settings.write("grad", CF);
}
function st(CF)
{
System.Gadget.Settings.write("style", CF);
}
function styley(CF)
{
System.Gadget.Settings.write("styley", CF);
}

 

System.Gadget.onSettingsClosing = SettingsClosing;
function SettingsClosing(event)
   {
      if (event.closeAction == event.Action.commit)
         {
             /*tagsSave  = tags_feld.value;
             speedSave = envVar.value;
             timeSave  = envVar3.value;
             langSave  = envVar4.value;
             tagsSave  = tagsSave.replace(/ /gi,",");
             var url   = tagsSave.replace(/ /gi,",");
                 url   = encodeURI(url);
             System.Gadget.Settings.write("tageString", tagsSave);
             System.Gadget.Settings.write("speedString", speedSave);
             System.Gadget.Settings.write("timeString", timeSave);
             System.Gadget.Settings.write("langString", langSave);
             System.Gadget.Settings.write("urlString", url);*/
             var win        = System.Gadget.Settings.read("win");
             if(win=='vista'){
             var userAgenty = document.getElementById('userAgenty').checked;
             System.Gadget.Settings.write("userAgenty", userAgenty);
             }
             var confirmy = document.getElementById('confirmy').checked;
             System.Gadget.Settings.write("confirmy", confirmy);
             
         }
      event.cancel = false;
   }
   
   
   
   
   
function search()
{

document.getElementById('erg').innerHTML = "<div>"+lang.wait+"</div>";
var rssDoc2 = new ActiveXObject("MSXML2.DOMDocument.3.0");
rssDoc2.onreadystatechange = popData2;
var search=document.getElementById('show').value;
search = encodeURI(search);
if(search == ''){search="New York";}

rssDoc2.load("http://weather.service.msn.com/data.aspx?src=vista&weasearchstr="+search+"&weadegreetype=C&culture=de-DE");

function popData2()
{
if(rssDoc2.readyState!=4)return;
var c2 = 0;
var rssItems2 = rssDoc2.selectNodes("/weatherdata/weather");
var max = 3;
if(rssItems2.length < max){max = rssItems2.length;}
document.getElementById('erg').innerHTML = "";
if(rssItems2.length == 0){document.getElementById('erg').innerHTML += "<div style='padding-top:5px;'>"+lang.setnothing+"</div>";}else{document.getElementById('erg').innerHTML += "<div style='padding-top:5px;'><b>"+lang.setchose+"</b></div>";}
for(var i=0;i<max;i++)
{
var icode  = rssItems2[i].selectSingleNode("./@weatherlocationcode").text;
var iname  = rssItems2[i].selectSingleNode("./@weatherlocationname").text;

document.getElementById('erg').innerHTML += "<input type='radio' name='i' onclick='save(\""+icode+"\", \""+iname+"\");' value='"+icode+"'> "+iname+"<br>";
}
document.getElementById('erg').innerHTML += '<div style="padding-top:5px;"><a href="javascript:stopp();" class="btn black">'+lang.setstopp+'</a></div>';
}
document.getElementById('erg').style.display        = "block";
document.getElementById('ortinput').style.display   = "none";
}




function save(code,name) {


var arrLine = name.split(",");
var finalName = arrLine[0];

if(finalName.indexOf(",") > -1){var s = finalName.split(",");finalName = s[0];}
if(finalName.indexOf("/") > -1){var s = finalName.split("/");finalName = s[0];}
if(finalName.indexOf(" ") > -1){var s = finalName.split(" ");finalName = s[0]+" "+s[1];}
if(finalName.length == 0){var finalName=arrLine[0];}


System.Gadget.Settings.write("ort", code);
System.Gadget.Settings.write("shortort", finalName);
System.Gadget.Settings.write("ortname", name);
document.getElementById('now').innerHTML = finalName + ' ('+name+')';
document.getElementById('show').value = name;

document.getElementById('erg').innerHTML = '<div style="padding-top:5px;"><b>'+lang.setchange+':</b></div>';
document.getElementById('erg').innerHTML += '<div style="padding-top:5px;"><input type="text" value="'+finalName+'" onchange="saveshortname()" id="shortort" /></div>';
document.getElementById('erg').innerHTML += '<div style="padding-top:5px;"><a href="javascript:document.getElementById(\'ortaktuell\').style.display = \'block\';document.getElementById(\'erg\').style.display = \'none\';document.getElementById(\'a1\').style.display = \'block\';document.getElementById(\'a2\').style.display = \'block\';document.getElementById(\'a3\').style.display = \'block\';document.getElementById(\'a4\').style.display = \'block\';document.getElementById(\'a5\').style.display = \'block\';document.getElementById(\'a6\').style.display = \'block\';document.getElementById(\'a7\').style.display = \'block\';document.getElementById(\'a8\').style.display = \'block\';" class="btn black">'+lang.setsave+'</a></div>';




}  
function saveshortname(){

System.Gadget.Settings.write("shortort", document.getElementById("shortort").value);  /**/
document.getElementById('now').innerHTML = System.Gadget.Settings.read("shortort") + ' ('+System.Gadget.Settings.read("ortname")+')';
document.getElementById('ortaktuell').style.display   = "block";
document.getElementById('erg').style.display          = "none"; 
}   
function stopp(){
document.getElementById('ortaktuell').style.display   = "block";
document.getElementById('erg').style.display          = "none";
}

function showstadt(){
document.getElementById('a1').style.display   = "none";
document.getElementById('a2').style.display   = "none";
document.getElementById('a3').style.display   = "none";
document.getElementById('a4').style.display   = "none";
document.getElementById('a5').style.display   = "none";
document.getElementById('a6').style.display   = "none";
document.getElementById('a7').style.display   = "none";
document.getElementById('a8').style.display   = "none";
document.getElementById('ortaktuell').style.display   = "none";
document.getElementById('ortinput').style.display   = "block";
}