<!--
/* 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 personal_close() {
	$(".personal_box").animate({width: "301"}, 1000);
	$("#personal_arrow_2").css('display', 'block');
	$("#personal_arrow_1").css('display', 'none');
	$("#company_testimonials").css('display', 'block');
}

function personal_open() {
	$("#company_testimonials").css('display', 'none');
	$(".personal_box").animate({width: "927"}, 1000);
	$("#personal_arrow_2").css('display', 'none');
	$("#personal_arrow_1").css('display', 'block');
	$("#business_testimonials").css('display', 'none');
}

function business_close() {

	$("#business_testimonials").css('display', 'none');
	$(".business_box").animate({width: "301"}, 1000);
	$("#business_arrow_2").css('display', 'block');
	$("#business_arrow_1").css('display', 'none');
	$("#company_testimonials").css('display', 'block');

}

function business_open() {
	$("#company_testimonials").css('display', 'none');
	$(".business_box").animate({width: "615"}, 1000);
	$("#business_arrow_2").css('display', 'none');
	$("#business_arrow_1").css('display', 'block');
	$("#business_testimonials").css('display', 'block');
	
}

function show_lang() {
	$('.languages').slideToggle("slow");
}



function show_go_button() {
		$('#button_go').css('background', 'url(/templates/www4/images/button_go_bottom_hover.jpg) left bottom no-repeat');
		$('#button_go_d').css('background', 'url(/templates/www4/images/button_go_top_hover.jpg) left top no-repeat');
		$('#button_go_a').css('background', 'url(/templates/www4/images/bg_tools3_on.jpg) left top repeat-y');
}


function hide_go_button() {
		$('#button_go').css('background', 'url(/templates/www4/images/button_go_bottom.jpg) left bottom no-repeat');
		$('#button_go_d').css('background', 'url(/templates/www4/images/button_go_top.jpg) left top no-repeat');
		$('#button_go_a').css('background', 'url(/templates/www4/images/bg_tools3.jpg) left top repeat-y');
}



function show_menu(id) {
	if(id == 1) {$('#menu_about').css('display', 'block');}
	if(id == 2) {$('#menu_1040').css('display', 'block');}
	if(id == 3) {$('#menu_1040nr').css('display', 'block');}
	if(id == 4) {$('#menu_international_students').css('display', 'block');}
	if(id == 5) {$('#menu_itin').css('display', 'block');}
	if(id == 6) {$('#menu_citizens').css('display', 'block');}
	if(id == 7) {$('#menu_investors').css('display', 'block');}
	if(id == 8) {$('#menu_vat').css('display', 'block');}
	if(id == 9) {$('#menu_other_countries').css('display', 'block');}
	if(id == 10) {$('#menu_contact').css('display', 'block');}
	if(id == 1 || id == 2 || id == 3 || id == 4 || id == 5 || id == 6 || id == 7 || id == 8 || id == 9) {
		//$('#a2_' + id).addClass('m2_on');
		$('#m2_' + id).addClass('m3_on');
	}
	if(id == 10) {
		$('#a2_' + id).addClass('m4_on');
		$('#m2_' + id).addClass('m5_on');
	}
	if(id == 0) {
		$('#menu_home').addClass('m7_on');
		$('#m2_' + id).addClass('m6_on');
	}
}

function show_download(id) {
	$('#download_button_container_' + id).css('background', 'url(/templates/www4/images/download_button_main_over.jpg) top left no-repeat');
	$('#download_button_bottom_' + id).css('background', 'url(/templates/www4/images/download_button_bottom_over.jpg) no-repeat');
}

function hide_download(id) {
	$('#download_button_container_' + id).css('background', 'url(/templates/www4/images/download_button_main.jpg) top left no-repeat');
	$('#download_button_bottom_' + id).css('background', 'url(/templates/www4/images/download_button_bottom.jpg) no-repeat');
}



function hide_menu(id) {
	if(id == 1) {$('#menu_about').css('display', 'none');}
	if(id == 2) {$('#menu_1040').css('display', 'none');}
	if(id == 3) {$('#menu_1040nr').css('display', 'none');}
	if(id == 4) {$('#menu_international_students').css('display', 'none');}
	if(id == 5) {$('#menu_itin').css('display', 'none');}
	if(id == 6) {$('#menu_citizens').css('display', 'none');}
	if(id == 7) {$('#menu_investors').css('display', 'none');}
	if(id == 8) {$('#menu_vat').css('display', 'none');}
	if(id == 9) {$('#menu_other_countries').css('display', 'none');}
	if(id == 10) {$('#menu_contact').css('display', 'none');}
	if(id == 1 || id == 2 || id == 3 || id == 4 || id == 5 || id == 6 || id == 7 || id == 8 || id == 9) {
		$('#a2_' + id).removeClass('m2_on');
		$('#m2_' + id).removeClass('m3_on');
	}
	if(id == 10) {
		$('#a2_' + id).removeClass('m4_on');
		$('#m2_' + id).removeClass('m5_on');
	}
	if(id == 0) {
		$('#menu_home').removeClass('m7_on');
		$('#m2_' + id).removeClass('m6_on');
	}
}

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);
}

/*
var live_1 = 0;
var new_live_text = '';
function show_live() {
		new_live_text += live_text.substr(live_1, 1);
		document.getElementById('style_small').innerHTML = new_live_text;
	live_1++;
	if (live_1 < live_text.length) {
		setTimeout('show_live()', 100);
	}else{
		live_1 = 0;
		new_live_text = '';
		setTimeout('show_live()', 3000);
	}
}
*/

$.fn.livehelpText = function() {	
	$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);
	
	
};

$(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');
		}
	});
	
	
	$('.livehelp-text').each(function() {
		$(this).livehelpText();
	});			

	if ( $('dl.faqs').length != 0 ) {	
		$('dl.faqs').each(function(){
			$(this).find('dt').click(function() {
				$(this).next('dd').slideToggle('slow'); 
			});
        });
	}
	
	
	
});

//-->

