$(document).ready(function(){	
	
		
		
		
		
		startTV();
	
		getWeather();
		
		
		
	});
	
	
	function getDetail(theId){
		document.location="tv_detail.aspx?tid=" + theId
	}
	
	function startTV(){
			
			var strVideo=''
		var strVideo2=''
		var strCounter=0
		
			$.ajax({
				type: "GET",
				url: "service_get.ashx?sid=a0afxos45dkidrkqxrcmhsy1&command=get_tv",
				dataType: "xml",
				beforeSend: function() {
					$("#mainFrame").html("<li><div style='margin-left:280px'><br/><img src='img/90.gif' alt='' border='0'/><br/><br/></div></li>")
					$("#mainFrame2").html("<li><div style='margin-left:280px'><br/><img src='img/90.gif' alt='' border='0'/><br/><br/></div></li>")
				},
				success: function(xml) {
					$(xml).find('video').each(function(){
						var id = $(this).find('video_id').text();
						var title = $(this).find('name').text();
						var subtitle = $(this).find('description').text();
						var url = $(this).find('url').text();
						var thumbnail = $(this).find('thumbnail').text();
						
							if(strCounter<6){
							
								strVideo+='<li onclick="getDetail(' + id + ')"><img src="http://www.wienweb.at/' + thumbnail + '" alt="" border="0" width="470"/><div class="subtitle"><p>' + subtitle +  '</p></div></li>'
							
							}
							
							else{
								strVideo2+='<li onclick="getDetail(' + id + ')"><img src="http://www.wienweb.at/' + thumbnail + '" alt="" border="0" width="156" height="118"/><div class="subtitle"><p>' + title +  '</p></div></li>'
							}	
								
						
						strCounter++
						
					});
					
					$('#mainFrame').html(strVideo);
					$('#mainFrame2').html(strVideo2);
					
					myCount=1
					myCount2=1
					$('#slider-code').tinycarousel({ 
						pager: true, 
						interval: true, 
						intervaltime: 5000, 
						rewind: false ,
						myloop: false,
						callback: function(element, index){
							myCount++
							if (myCount==6){
								$('#slider-code2').tinycarousel({ 
									pager: false, 
									interval: true, 
									intervaltime: 3000, 
									rewind: false,
									axis: 'y',
									myloop: false,
									callback: function(element, index){
										myCount2++
										if (myCount2==24){
											document.location="default.aspx"
										}
									}	
								});
							}
						}
			
					});
				}
			});	
	}
