
function Toggle(item){var children=item.getElementsByTagName('div');var content=null;var link=null;for(var i=0;i<children.length;i++){if(children[i].className=='css_submenu_sub')
content=children[i];if(children[i].className=='css_mainmenu_sub')
link=children[i];}
CollapseAllLi(content,link);if(content!=null){if(content.style.display=='none'){content.style.display='block';}
else{content.style.display='none';}
if(link!=null){if(content.style.display=='block'){link.style.color='#666666';}
else{link.style.color='';}}}}
function SetMenuColor(id){var li=document.getElementById(id);if(li){li.style.color='#F15C22';}}
function CollapseAllLi(content,link){var menu=document.getElementById('menu');if(menu){var children=menu.getElementsByTagName('div');for(var i=0;i<children.length;i++){if(children[i].className=='css_submenu_sub'&&children[i]!=content)
children[i].style.display='none';;if(children[i].className=='css_mainmenu_sub'&&children[i]!=link)
children[i].style.color='';}}}
function popup(windowname,blanket_id,divIdsArray){this.windowname=windowname;this.blanket_id=blanket_id;this.divIdsArray=divIdsArray;this.currentDiv=0;this.closePopUp=function(){var el=document.getElementById(this.windowname);if(el){var popUpContent=document.getElementById('pop_up_content');if(popUpContent){popUpContent.innerHTML='';}
el.style.display='none';}
var blanket=document.getElementById(this.blanket_id);if(blanket){blanket.style.display='none';}}
this.blanket_size=function(popUpDivVar){if(typeof window.innerWidth!='undefined'){viewportheight=window.innerHeight;}else{viewportheight=document.documentElement.clientHeight;}
if((viewportheight>document.body.parentNode.scrollHeight)&&(viewportheight>document.body.parentNode.clientHeight)){blanket_height=viewportheight;}else{if(document.body.parentNode.clientHeight>document.body.parentNode.scrollHeight){blanket_height=document.body.parentNode.clientHeight;}else{blanket_height=document.body.parentNode.scrollHeight;}}
var blanket=document.getElementById('blanket');blanket.style.height=blanket_height+'px';var popUpDiv=document.getElementById(popUpDivVar);popUpDiv_height=blanket_height/2-365;popUpDiv.style.top=60+'px';}
this.window_pos=function(popUpDivVar){if(typeof window.innerWidth!='undefined'){viewportwidth=window.innerHeight;}else{viewportwidth=document.documentElement.clientHeight;}
if((viewportwidth>document.body.parentNode.scrollWidth)&&(viewportwidth>document.body.parentNode.clientWidth)){window_width=viewportwidth;}else{if(document.body.parentNode.clientWidth>document.body.parentNode.scrollWidth){window_width=document.body.parentNode.clientWidth;}else{window_width=document.body.parentNode.scrollWidth;}}
var popUpDiv=document.getElementById(popUpDivVar);window_width=window_width/2-365;popUpDiv.style.left=100+'px';}
this.prev=function(div_content_id){if(div_content_id!=null){var div_content=document.getElementById(div_content_id);if(div_content!=null){var popUpContent=document.getElementById('pop_up_content');if(popUpContent){popUpContent.innerHTML='';div_content.style.display='block';popUpContent.innerHTML=div_content.innerHTML;div_content.style.display='none';}}
this.currentDiv=this.currentDiv-1;var prevLink=document.getElementById('prev_pop_up');var nextLink=document.getElementById('next_pop_up');if(prevLink&&nextLink){prevLink.removeAttribute('onclick');nextLink.removeAttribute('onclick');if(this.divIdsArray[this.currentDiv-1])
prevLink.setAttribute('onclick',"popup.prev('"+this.divIdsArray[this.currentDiv-1]+"')");else
prevLink.setAttribute('onclick',"popup.closePopUp()");if(this.divIdsArray[this.currentDiv+1])
nextLink.setAttribute('onclick',"popup.next('"+this.divIdsArray[this.currentDiv+1]+"')");else
nextLink.setAttribute('onclick',"popup.closePopUp()");}}}
this.next=function(div_content_id){if(div_content_id!=null){var div_content=document.getElementById(div_content_id);if(div_content!=null){var popUpContent=document.getElementById('pop_up_content');if(popUpContent){popUpContent.innerHTML='';div_content.style.display='block';popUpContent.innerHTML=div_content.innerHTML;div_content.style.display='none';}}
this.currentDiv=this.currentDiv+1;var prevLink=document.getElementById('prev_pop_up');var nextLink=document.getElementById('next_pop_up');if(prevLink&&nextLink){prevLink.removeAttribute('onclick');nextLink.removeAttribute('onclick');if(this.divIdsArray[this.currentDiv-1])
prevLink.setAttribute('onclick',"popup.prev('"+this.divIdsArray[this.currentDiv-1]+"')");else
prevLink.setAttribute('onclick',"popup.closePopUp()");if(this.divIdsArray[this.currentDiv+1])
nextLink.setAttribute('onclick',"popup.next('"+this.divIdsArray[this.currentDiv+1]+"')");else
nextLink.setAttribute('onclick',"popup.closePopUp()");}}}
this.toggle=function(div_content_id){this.blanket_size(this.windowname);this.window_pos(this.windowname);var el=document.getElementById(this.windowname);if(el.style.display=='none'){el.style.display='block';if(div_content_id!=null){var div_content=document.getElementById(div_content_id);if(div_content!=null){var popUpContent=document.getElementById('pop_up_content');if(popUpContent){div_content.style.display='block';popUpContent.innerHTML=div_content.innerHTML;div_content.style.display='none';}}
for(var i=0;i<this.divIdsArray.length;i++){if(div_content_id==this.divIdsArray[i]){this.currentDiv=i;break;}}
var prevLink=document.getElementById('prev_pop_up');var nextLink=document.getElementById('next_pop_up');if(prevLink&&nextLink){if(this.divIdsArray[this.currentDiv-1])
prevLink.setAttribute('onclick',"popup.prev('"+this.divIdsArray[this.currentDiv-1]+"')");else
prevLink.setAttribute('onclick',"popup.closePopUp();");if(this.divIdsArray[this.currentDiv+1])
nextLink.setAttribute('onclick',"popup.next('"+this.divIdsArray[this.currentDiv+1]+"')");else
nextLink.setAttribute('onclick',"popup.closePopUp();");}}}
else{el.style.display='none';}
var blanket=document.getElementById(this.blanket_id);if(blanket.style.display=='none'){blanket.style.display='block';}else{blanket.style.display='none';}}}
function weatherWidget(){this.timeout=setTimeout("this.doAjaxCall()",3000);this.doAjaxCall=function(){debugger;$.ajax({url:'weather.xml',type:'GET',dataType:'xml',timeout:1000,error:function(){alert('Error loading XML document');},success:function(xml){$(xml).find('temperature').each(function(){var item_text=$(this).text();$('<div></div>').html(item_text).css('background','yellow').css('width','100px').css('height','100px').appendTo("body");;});}});}}
