﻿<!--
/* Slide show */
var all_zmiana = 2; // How many images

/* News */
var all_news = 4; // How many news

/* Live Help text */
//var live_text = 'Get instant answers here...'; 

//var live_text = document.getElementById('style_small').innerHTML;



var video_width_pro = 1;
var video_width_all = 301;
var video_start = 0;
var czy_stop = 1;
var video_ok = 0;
var video_width;


function show_lang() {
	$('.languages').slideToggle("slow");
}

function show_go_button() {
		$('#button_go').css('background', 'url(/wwwo/images/button_go_bottom_hover.jpg) left bottom no-repeat');
		$('#button_go_d').css('background', 'url(/wwwo/images/button_go_top_hover.jpg) left top no-repeat');
		$('#button_go_a').css('background', 'url(/wwwo/images/bg_tools3_on.jpg) left top repeat-y');
}


function hide_go_button() {
		$('#button_go').css('background', 'url(/wwwo/images/button_go_bottom.jpg) left bottom no-repeat');
		$('#button_go_d').css('background', 'url(/wwwo/images/button_go_top.jpg) left top no-repeat');
		$('#button_go_a').css('background', 'url(/wwwo/images/bg_tools3.jpg) left top repeat-y');
}

function show_live_button() {
		$('#button_live').css('background', 'url(/wwwo/images/bg_tools2_on.jpg) left bottom no-repeat');
		$('#button_live_d').css('background', 'url(/wwwo/images/button_live_on.gif) left top no-repeat');
		$('#button_live_a').css('background', 'url(/wwwo/images/bg_tools3_on.jpg) left top repeat-y');
}

function hide_live_button() {
		$('#button_live').css('background', 'url(/wwwo/images/bg_tools2.jpg) left bottom no-repeat');
		$('#button_live_d').css('background', 'url(/wwwo/images/button_live_off.gif) left top no-repeat');
		$('#button_live_a').css('background', 'url(/wwwo/images/bg_tools3.jpg) left top repeat-y');
}


function show_download(id) {
	$('#download_button_container_' + id).css('background', 'url(/wwwo/images/download_button_main_over.jpg) top left no-repeat');
	$('#download_button_bottom_' + id).css('background', 'url(/wwwo/images/download_button_bottom_over.jpg) no-repeat');
}

function hide_download(id) {
	$('#download_button_container_' + id).css('background', 'url(/wwwo/images/download_button_main.jpg) top left no-repeat');
	$('#download_button_bottom_' + id).css('background', 'url(/wwwo/images/download_button_bottom.jpg) no-repeat');
}

function new_bar() {
	var video_width_tmp = $(".inside_video_2_in").css('width');
	if (video_width_tmp) {
	video_width_tmp = video_width_tmp.substr(0, (video_width_tmp.length-2));
	video_width_tmp = video_width_tmp * 1;
	video_width_all = video_width_tmp;
	video_width_pro = video_width_tmp;
	if(video_width_tmp > 301) {
		video_width = 301/video_width_tmp;
		video_width_pro = video_width;
		video_width = Math.floor(279 * video_width);
	}else{
		video_width = 279;
		video_width_pro = 1;
	}

	$("#new_scrollbar").css('width', video_width + 'px');
	}
}

function video_left() {
	czy_stop = 0;
	video_left_move();
}

function video_left_stop() {
	czy_stop = 1;
}

function video_left_move() {
	if( video_start >= 0) {
		czy_stop = 1;
		video_start = 0;
	}else{
		if(czy_stop == 0){
			setTimeout(video_left_move, 10);
		}
		video_start += 5;
	}
	xxx = video_start/(301-video_width_all);
	yyy = (xxx * (279 - video_width));
	$(".inside_video_2_in").css('left', video_start + 'px');
	$("#new_scrollbar").css('left', yyy + 'px');
}

function video_right() {
	czy_stop = 0;
	video_right_move();
}

function video_right_stop() {
	czy_stop = 1;
}

function video_right_move() {
	if( (301-video_width_all) >= video_start) {
		czy_stop = 1;
	}else{
		if(czy_stop == 0){
			setTimeout(video_right_move, 10);
		}
		video_start -= 5;
	}
	xxx = video_start/(301-video_width_all);
	yyy = (xxx * (279 - video_width));
	$(".inside_video_2_in").css('left', video_start + 'px');
	$("#new_scrollbar").css('left', yyy + 'px');
}

var var_zmiana = (all_zmiana - 1);
var sel_zmiana = 3;

function show_foto_l() {
	sel_zmiana = 1;
	hide_foto();
	setTimeout('back_foto()', 1000);
}

function show_foto_p() {
	sel_zmiana = 2;
}

function show_foto_r() {
	sel_zmiana = 3;
	hide_foto();
	setTimeout('show_foto()', 1000);
}

function zmiana(){
	if(sel_zmiana == 1){
		hide_foto();
		setTimeout('back_foto()', 1000);
	}
	if(sel_zmiana == 3){
		hide_foto();
		setTimeout('show_foto()', 1000);
	}
	setTimeout('zmiana()', 9000);
}

function show_foto() {
	var_zmiana = ((var_zmiana+1)%all_zmiana);
	$('#slide_' + var_zmiana).fadeIn("1000");
}

function back_foto() {
	var_zmiana = ((var_zmiana-1)%all_zmiana);
	if(var_zmiana < 0){var_zmiana += all_zmiana;}
	$('#slide_' + var_zmiana).fadeIn("1000");
}

function hide_foto() {
	$('.slide_img').fadeOut("1000");
}

var var_news = (all_news - 1);

function last_news() {
	var a=0;
	for(a=0;a<all_news;a++) {
		if((a%2) == 1) {
			//$('#news_item_' + a).css('background', 'transparent');
		}
	}
}

function news_changes(){
	$('.inside_news_item').css('display', 'none');
	var_news += 2;
	if(var_news >= all_news){var_news = 0;}
	$('#news_item_' + var_news).fadeIn("slow");
	$('#news_item_' + (var_news + 1)).fadeIn("slow");
	setTimeout('news_changes()', 6000);
}

(function($) {
	$.fn.livehelpText = function() {	
		var $self = $(this);
		var text = $self.text();
		var i = 0;
		var new_text = '';
		window.setInterval(function() {
			if ( i == text.length ) {
				i = 0;
				new_text = '';
			}
			
			new_text += text.substr(i,1);
			i ++;
			$self.text(new_text);
			
		},150);
		
		
	};
})(jQuery);

$(function() {

	$("#new_scrollbar").draggable({
		axis: 'x', 
		containment: '.inside_video_nav_b', 
		scroll: false, 
		drag: function() {
			xxx = $("#new_scrollbar").css('left');
			xxx = xxx.substr(0, (xxx.length-2));
			pro = xxx/(279 - video_width);
			yyy = (video_width_all - 301) * pro;
			video_start = 0 - yyy;
			$(".inside_video_2_in").css('left', '-' + yyy + 'px');
		}
	});
	
	$("#menu_main").myMenuDropDown({effect:""});
	
	$('span.livehelp-text').each(function() {
		$(this).livehelpText();
	});	
});

//-->

