$(function() {

		$('#li2').hover(
		function(){
			var inw = $("#li2").position();
			var inwleft = inw.left/1;
			document.getElementById("menuCrumb2").style.display = 'block';
	if(document.all)
	{myMinus = 10;}else{myMinus = 8;}
			inwleft = inwleft - myMinus/1;
			document.getElementById("menuCrumb2").style.left = inwleft + 'px';
			},
		function(){
			document.getElementById("menuCrumb2").style.display = 'none';
		}
	);

		$('#li3').hover(
		function(){
			var inw = $("#li3").position();
			var inwleft = inw.left/1;
			document.getElementById("menuCrumb").style.display = 'block';
	if(document.all)
	{myMinus = 10;}else{myMinus = 8;}
			inwleft = inwleft - myMinus/1;
			document.getElementById("menuCrumb").style.left = inwleft + 'px';
			},
		function(){
			document.getElementById("menuCrumb").style.display = 'none';
		}
	);

	$('#li4').hover(
		function(){
			document.getElementById("mbhref").innerHTML = document.getElementById("lichspantxt").innerHTML;
			var inw = $("#li4").position();
			var inwleft = inw.left/1;
			document.getElementById("menu3").style.display = 'block';
	if(document.all)
	{myMinus = 10;}else{myMinus = 8;}
			inwleft = inwleft - myMinus/1;
			document.getElementById("menu3").style.left = inwleft + 'px';
			},
		function(){
			document.getElementById("menu3").style.display = 'none';
		}
	);		   
		   


	$('.search_field').focus(function() {
		if ($(this).attr('value') == 'iiene') $(this).attr('value', '');
	});
	$('.search_field').blur(function() {
		if ($(this).attr('value') == '') $(this).attr('value', 'iiene');
	});
	
	$('#menu2 .dropdown').toggle(
		
		function(){
			// dav 2010-07-30
			// $('#menu2').css('background-image', 'url("/images/natinvest/menu2_bg_t.png")');
			// $('#menu2_bg').css('background-image', 'url("/images/natinvest/menu2_bg_c.png")');
			// $('#menu2_bg_b').css('background-image', 'url("/images/natinvest/menu2_bg_b.png")');
			$('#menu2 ul').slideDown(500);	
			ignore2 = true;
		},
		function(){
			$('#menu2 ul').slideUp(300, function() {
			// dav 2010-07-30
			// $('#menu2, #menu2_bg, #menu2_bg_b').css('background-image', 'none');
				
			ignore2 = false;
			});
		}
		
	);
	
	$('#brands li.dropdown').hover(
		function(){
			$('li.dropdown2 ul').stop().animate({opacity:0.0, width:0}, 50);
			$(this).css('background-image', 'url("/images/natinvest/brands_bg.png")');
			$('ul.dropdown2', this).fadeIn(500);
			ignore2 = true;
		},
		function(){
			$('ul.dropdown2', this).fadeOut(300);
			
			if ('br_' + action_brand == $(this).attr('id'))
			{
				
			}
			else
			{			
				$(this).css('background-image', 'none');
			}
			
			ignore2 = false;
		}
	);

	$('li.dropdown2').hover(
		function(){
			$('ul', this).stop().animate({opacity:1.0, width:183}, 500);
		},
		function(){
			$('ul', this).stop().animate({opacity:0.0, width:0}, 400);
		}
	);

	$('#breadcrumbs li:last').css('background-image','none');
	
	$('#content table tr:last td').css('border','none');

});

function show_sq(cnt) {
	
	var h = '';
	var i_s = '';
	$('#squares').html('');
	
	
	for(var i=1;i<=cnt; i++) {
		i_s = i.toString();
		h = '<a href="javascript:void(0)" onclick="sq_activate(' + i_s + '); return false;" id="sq'+i_s+'"><img src="/images/natinvest/squares/sq'+i_s+'_d.gif" width="21" height="26"></a>';
		$('#squares').append(h);
	}

}

function show_sq_with_active(cnt, current) {
	

	var h = '';
	var i_s = '';
	$('#squares').html('');
	for(var i=1;i<=cnt; i++) {
		i_s = i.toString();
		if (i < current) {
			h = '<a href="javascript:void(0)" onclick="sq_activate(' + i_s + '); return false;" id="sq'+i_s+'"><img src="/images/natinvest/squares/sq'+i_s+'.gif" width="21" height="26"></a>';
		} else if (i == current) {
			h = '<a href="javascript:void(0)" onclick="sq_activate(' + i_s + '); return false;" id="sq'+i_s+'"><img src="/images/natinvest/squares/sq'+i_s+'_a.gif" width="21" height="26"></a>';
		} else {
			h = '<a href="javascript:void(0)" onclick="sq_activate(' + i_s + '); return false;" id="sq'+i_s+'"><img src="/images/natinvest/squares/sq'+i_s+'_d.gif" width="21" height="26"></a>';
		}
		$('#squares').append(h);
	}
}

function sq_activate(num) {
	sw = true;
	sw_to = num;
}

function urdecode_thistext()
{
document.getElementById('sub_text_class_id').innerHTML = unescape(document.getElementById('sub_text_class_id').innerHTML);
}

function check_carusel()
{
		if($('.jcarousel-skin-tango2 IMG').size()==0){jQuery('#hdiv_content').hide(0);}
}

function reget_subtxt(mysubtextId)
{
//$.post('/gal-inside/?method=actionReportSimple',{'my_stext':mysubtextId},function(data){$('#sub_text_class_id').html(data);});
}

function itemLoadCallbackFunction(carousel, state)
{
    for (var i = carousel.first; i <= carousel.last; i++) {
        // Check if the item already exists
        if (!carousel.has(i)) {
            // Add the item
            carousel.add(i, "I'm item #" + i);
        }
    }
};

function goglFix()
{
	lisize = $(".jcarousel-skin-tango2 LI").size();
	lileft = $(".jcarousel-skin-tango2 LI").css('left');
	rlileft = lileft.replace(/px/i, "");
	if( rlileft*(-1) >= ((lisize*124) - 124*3) ){}
	else
	{
		$(".jcarousel-skin-tango2 LI").css({ 'position':'relative' }).animate({'left':'-='+(124*3)}, 400);
	}

}

function goglLeftFix()
{
	lisize = $(".jcarousel-skin-tango2 LI").size();
	lileft = $(".jcarousel-skin-tango2 LI").css('left');
	rlileft = lileft.replace(/px/i, "");
	if( rlileft >0 ){}
	else
	{
		$(".jcarousel-skin-tango2 LI").css({ 'position':'relative' }).animate({'left':'+='+(124*3)}, 400);
	}

}

function getProcessDetail(processId, titlik)
{
document.getElementById('sub_text_class_title').innerHTML = titlik;
$.post('/gal-inside/?method=actionReportSimple',{'my_sub':processId},function(data){$('#sub_text_class_id').html(data);});
$.get('/gal-inside/?method=actionReportSimple',{'main_img':processId},function(data){$('#main_loockup_id').html(data); $('a.lightbox').lightBox();});
$.get('/gal-inside/?method=actionReportSimple',{'detailProcessId':processId},function(data){ $('.jcarousel-skin-tango2').queue(function(){ $('.jcarousel-skin-tango2').html(data).jcarousel();

if(navigator.userAgent.indexOf ('Chrome') != -1 || navigator.userAgent.indexOf ('Safari') != -1)
{
$(".jcarousel-skin-tango2 DIV[class*='jcarousel-next']").attr('onClick', "goglFix();");
$(".jcarousel-skin-tango2 DIV[class*='jcarousel-prev']").attr('onClick', "goglLeftFix();");
}

$(this).dequeue(); }); check_carusel(); });
}

function getBodyScrollTop()
{
  return self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop);
}

function cl_hdiv()
{
$("#hdiv").css('top',getBodyScrollTop() + 250);
jQuery('#hdiv').hide('slow');
$(".jcarousel-skin-tango2").remove();
var bread_pos = $('#breadcrumbs').offset().left;
document.getElementById('hdiv').style.left = bread_pos + 'px';
document.getElementById('hdiv_content').innerHTML = "<ul class='jcarousel-skin-tango2'></ul>";
document.getElementById('hdiv_content').style.display = 'block';
document.getElementById('sub_text_class_id').innerHTML = '';
}

function reget_image(src)
{
jQuery('#main_loockup_id').hide('slow', function () {
document.getElementById('main_lookup_img').src = '/resizer3.php?src=/netcat_files/'+src+'/&w=364&h=253&mode=1';
/*document.getElementById('main_lookup_href').href = '/netcat_files/'+src;
document.getElementById('main_lookup_href').name = '/netcat_files/'+src;*/
jQuery('#main_loockup_id').show('slow');
});
}

function opn_moz_img(src,wid,hei)
{
	if(navigator.userAgent.indexOf ('irefox') != -1) 
	{
		document.getElementById('main_lookup_href').href = '#';
	mypop = window.open(src,'pic','width='+wid+',height='+hei+',menubar=no,status=no,location=no,scrollbars=no,fullscreen=no,directories=no,resizable=no,top='+innerHeight/2.6+',left='+innerWidth/2.8);
		}
}



