var ROLLER_ANIMATION_SPEED = 100;
var ROLLER_ANIMATION_DELTA = 20;
var roller_interval;

if(homepage != "1")
{
var img1 = new Image(207,110);
img1.src = 'http://www.2uk.co.il/images/traffic.jpg';
var img2 = new Image(207,110);
img2.src = 'http://www.2uk.co.il/images/traffic-2.jpg';
var img3 = new Image(207,110);
img3.src = 'http://www.2uk.co.il/images/weather2.jpg';
var img4 = new Image(207,110);
img4.src = 'http://www.2uk.co.il/images/weather-2.jpg';
var img5 = new Image(207,110);
img5.src = 'http://www.2uk.co.il/images/food.jpg';
var img6 = new Image(207,110);
img6.src = 'http://www.2uk.co.il/images/food-2.jpg';
var img7 = new Image(207,110);
img7.src = 'http://www.2uk.co.il/images/flag.jpg';
var img8 = new Image(207,110);
img8.src = 'http://www.2uk.co.il/images/flag-2.jpg';
var img9 = new Image(207,110);
img9.src = 'http://www.2uk.co.il/images/history.jpg';
var img10 = new Image(207,110);
img10.src = 'http://www.2uk.co.il/images/history-2.jpg';
var img11 = new Image(207,110);
img11.src = 'http://www.2uk.co.il/images/kingdom.jpg';
var img12 = new Image(207,110);
img12.src = 'http://www.2uk.co.il/images/kingdom-2.jpg';
var img13 = new Image(207,110);
img13.src = 'http://www.2uk.co.il/images/night.jpg';
var img14 = new Image(207,110);
img14.src = 'http://www.2uk.co.il/images/night-2.jpg';
var img15 = new Image(207,110);
img15.src = 'http://www.2uk.co.il/images/shopping.jpg';
var img16 = new Image(207,110);
img16.src = 'http://www.2uk.co.il/images/shopping-2.jpg';
var img17 = new Image(207,110);
img17.src = 'http://www.2uk.co.il/images/shows.jpg';
var img18 = new Image(207,110);
img18.src = 'http://www.2uk.co.il/images/shows-2.jpg';
var img19 = new Image(207,110);
img19.src = 'http://www.2uk.co.il/images/sport.jpg';
var img20 = new Image(207,110);
img20.src = 'http://www.2uk.co.il/images/sport-2.jpg';
var img21 = new Image(207,110);
img21.src = 'http://www.2uk.co.il/images/roller_banner_flight.jpg';
var img22 = new Image(207,110);
img22.src = 'http://www.2uk.co.il/images/roller_banner_flight_hover.jpg';
var img23 = new Image(207,110);
img23.src = 'http://www.2uk.co.il/images/roller_banner_studies.jpg';
var img24 = new Image(207,110);
img24.src = 'http://www.2uk.co.il/images/roller_banner_studies_hover.jpg';
var img25 = new Image(207,110);
img25.src = 'http://www.2uk.co.il/images/roller_banner_soccer.jpg';
var img26 = new Image(207,110);
img26.src = 'http://www.2uk.co.il/images/roller_banner_soccer_hover.jpg';
}

function ShowHide(id)
{
	var obj;
	if (document.getElementById)
		obj=document.getElementById("d_" + id)
	else if (document.all)
		obj=document.all["d_" + id]
	obj.style.display = (obj.style.display=="block"?"none":"block");
}

function startScrollRollerRight(){
	clearInterval(roller_interval);
	roller_interval = setInterval('scrollRoller('+ROLLER_ANIMATION_DELTA+')',ROLLER_ANIMATION_SPEED);
}
function startScrollRollerLeft(){
	clearInterval(roller_interval);
	roller_interval = setInterval('scrollRoller(-'+ROLLER_ANIMATION_DELTA+')',ROLLER_ANIMATION_SPEED);
}
function scrollRoller(delta){
try
  {
	var obj = document.getElementById('roller-content');
	var contentWidth = document.getElementById('roller-content-body').offsetWidth;
	var maxRight = -contentWidth+obj.parentNode.parentNode.clientWidth;
	var right = parseInt((obj.style.right==''?0:obj.style.right.replace('px','')));
		right = Math.max(maxRight,Math.min(0,right+delta));
	
	if(right==0 || right==maxRight){
		$(obj).animate({right: right?0:maxRight});
		//clearInterval(roller_interval);
	}else
		obj.style.right = right+'px';
}
catch(err)
  {
  //Handle errors here
  }
	
}
function stopScrollRoller(){
	clearInterval(roller_interval);
}

var GALLERY_FADING_DELAY = 1000;
var GALLERY_AUTOMATIC_DELAY = 8000;
var GALLERY_AUTOMATIC_FADING_DELAY = 2000;
var galleryAnimation = false;
var galleryCurrentPN = 1;
if(homepage=='1')
	var galleryAuto = setInterval('switchGalleryNextImage()',GALLERY_AUTOMATIC_DELAY);
function switchGalleryNextImage(){
	var images = $('#gallery-pages-menu a.page-number').length;
	switchGalleryImage(1+galleryCurrentPN%images,GALLERY_AUTOMATIC_FADING_DELAY);
}
function switchGalleryImage(pn,fading_delay){
	if(galleryAnimation) return;
	if(!fading_delay) fading_delay = GALLERY_FADING_DELAY;
	galleryAnimation = true;
	galleryCurrentPN = pn;
	
	var currentPage = $('#gallery-body .gallery-page.current');
	var nextPage = $('#gallery-body .gallery-page:eq('+(pn-1)+')');
	var obj = $('#gallery-pages-menu a.page-number:eq('+(pn-1)+')');

	$('.page-number').removeClass('current');
	$(obj).addClass('current');
	currentPage.fadeOut(fading_delay,function(){
		currentPage.removeClass('current');
		nextPage.fadeIn(fading_delay, function(){
			nextPage.addClass('current');
			galleryAnimation = false;
		});
	});
}

var TAB_ANIMATION_DELAY = 1000;
var animation = false;
function chooseTab(box_id, index){
	if(animation) return;
	
	var box = $('#'+box_id);
	$('#'+box_id+' .tabs a.tab').removeClass('current');
	$('#'+box_id+' .tabs a.tab:eq('+(index-1)+')').addClass('current');
	var content = $('#'+box_id+' .content');
	var found = false;
	for(var i=0;i<content.length;i++)
	{
		if($(content[i]).css('display')!='none' && i!=(index-1)){
			animation = found = true;
			if(i>(index-1)){
				$(content[i]).hide('slide',{dir: 'l'},TAB_ANIMATION_DELAY,function(){
					$('#'+box_id+' .content:eq('+(index-1)+')').show('slide',{direction: 'r'},TAB_ANIMATION_DELAY,function(){animation=false;});
				});
			}else
				$(content[i]).hide('slide',{direction: 'r'},TAB_ANIMATION_DELAY,function(){
					$('#'+box_id+' .content:eq('+(index-1)+')').show('slide',{dir: 'r'},TAB_ANIMATION_DELAY,function(){animation=false;});
				});
		}
	}
	if(!found)
		$('#'+box_id+' .content:eq('+(index-1)+')').fadeIn(TAB_ANIMATION_DELAY,function(){animation=false;});
}

function setWeather(degrees){
	degrees = degrees.split(',');
	$('#weather-today').text(degrees[0]+'°c');
	$('#weather-tonight').text(degrees[1]+'°c');
	$('#weather-tomorrow').text(degrees[2]+'°c');
}
function Open_PopUp(msgid)
{
	window.location="http://www.2uk.co.il/UserData.aspx";}
function Open_PopUpTzatet(msgid)
{
	window.location="http://www.2uk.co.il/UserData.aspx";}
function OpenPopUp(msgid)
{
	window.open("PopUpForum.aspx?msgid=" + msgid,'PopUpForum','height=500,width=600');}
function OpenPopUpTzatet(msgid)
{
	window.open("PopUpForum.aspx?msgid=" + msgid + "&tz=1",'PopUpForum','height=500,width=600');}
function OpenPopUpSendToFriend()
{
	window.open("SendFriendEmail.aspx?isfriend=1" ,'PopUpForum','height=300,width=600');}
function OpenPopUpSendTo()
{
	window.open("SendFriendEmail.aspx",'PopUpForum','height=10,width=10');}
function Open_PopUpSendToFriend()
{
	window.location="http://www.2uk.co.il/UserData.aspx";}

function OpenPopUpSendToFriendPage()
{
	window.open("http://www.2uk.co.il/PopUpSendToFriend.aspx" ,'PopUpForum','height=300,width=600');}
function Open_PopUpSendTo()
{
	window.location="http://www.2uk.co.il/UserData.aspx";}
function OpenFPopUp(msgfid)
{
	window.open("PopUpForum.aspx?msgfid=" + msgfid,'PopUpForum','height=500,width=600');}
function OpenEditorPopUp(msgid)
{
	window.open("PopUpForumEditor.aspx?msgid=" + msgid,'PopUpForum','height=500,width=600');}
function OpenEditorDelPopUp(msgid)
{
	window.open("PopUpForumDel.aspx?msgid=" + msgid,'PopUpForum','height=10,width=10');}
function wmpCreate(url) { 
		var str = ""; 
		if(-1 != navigator.userAgent.indexOf("MSIE")) { 
			// create the WMP for IE 
			str = '<object id="contentPlayer" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="320" height="240">'; 
		} else { 
			// create it for FF. 
			str = '<object id="contentPlayer" type="application/x-ms-wmp" data="'+url+'" width="320" height="240">'; 
		} 
		str += '<param name="URL" value="'+url+'" />'; 
		str += '<param name="uiMode" value="none">'; 
		str += '</object>'; 
		return str; 
	} 
	function wmpPlayStop() { 
		wmp.controls.stop();
	}
	function wmpPlayPause() {
		wmp.controls.pause();
	}
	function wmpPlayPlay() {
		wmp.controls.play();
	}
	function wmpPlayMute() {
	wmp.settings.mute = !wmp.settings.mute;
	}
	function wmpPlayMutet() {
		if(wmp.settings.mute)
		{
			wmp.settings.mute = false;
		}
		else
		{ 
			wmp.settings.mute = true; 
			}
	}
function ShowHideWeather(id)
{
//debugger;
//alert(id.value);
document.getElementById("weather_London").style.display = "none";
document.getElementById("weather_Edinburgh").style.display = "none";
document.getElementById("weather_Dublin").style.display = "none";
	var obj;
	if (document.getElementById)
		obj=document.getElementById("weather_" + id.value)
	else if (document.all)
		obj=document.all["weather_" + id.value]
	//obj.style.display = (obj.style.display=="block"?"none":"block");
	obj.style.display = "block";
}
