AddScript("jquery/swfobject.js");

var n_avalA = "modules/ntng/images/n_aval.gif";
var n_avalU = "modules/ntng/images/user.png";
function __erA(obj) { if(obj.src.indexOf(n_avalA) == -1 ) obj.src = n_avalA; }
function __erU(obj) { if(obj.src.indexOf(n_avalU) == -1 ) obj.src = n_avalU; }

function GSrcSet()
{
	var prefix = "";
	var gSrc = false;
	var push = {};
	
	push["sf_p1"] = $('#sf_p1').val();
	if($('#sf_p2').length > 0) push["sf_p2"] = $('#sf_p2').val();
	var x = document.getElementsByTagName("input");
	for (var i=0 ; i<x.length ; i++)
	{
		if(x[i].id.indexOf("sf") != -1 )
		{
			if ($("#"+x[i].id).attr("type")=="text")
			{
			
				if(x[i].value != "")
				{
					push[x[i].id.replace(prefix,"")] = escape(x[i].value).replace("%2C",",");
					gSrc = true;
				} else push[x[i].id.replace(prefix,"")] = "";
			}
			else if ($("#"+x[i].id).attr("type")=="checkbox") { ; }
			else if ($("#"+x[i].id).attr("type")=="radio") { ; }	
		}
	}
	
	var x = document.getElementsByTagName("select");
	for (var i=0 ; i<x.length ; i++)
	{
	    if(x[i].id.indexOf("sf") != -1 )
		{
		    if(x[i].value != "")
		    {
			    push[x[i].id.replace(prefix,"")] = escape(x[i].value);
			    gSrc = true;
		    } else push[x[i].id.replace(prefix,"")] = "";
		}
	}
	
	push["pg"] = "1";
	push["item"] = "";

   window.location.href = PrepareUrl(push);
}

function mCp(page,btn)
{
    var push = {};
    push["pg"] = page;
    window.location.href = PrepareUrl(push);	
}

function mCs(sort,btn)
{	
	if(GetObject('st'))
		GetObject('st').value = sort;	
	else
	{
		var element;
		if(Browser.isIE)
			element = document.createElement("<input type='hidden' name='st' value='" + sort + "' />");
		else
		{
			element = document.createElement("input");
			element.type = "hidden";
			element.name = "st";
			element.value = sort;
		}
		document.forms[0].appendChild(element);
	}	
	document.forms[0].submit();
}


function KeyDownSrc(event, btn)
{
	if (event.keyCode == 13 )
	{	
		event.returnValue = false;
		event.cancel = true;
		if (document.getElementById(btn))
		{
			document.getElementById(btn).focus();
			document.getElementById(btn).click();
		}
		return false;
	}
}

if( window.attachEvent == null )
{
    HTMLElement.prototype.attachEvent = function(sType,fHandler)
    {
        var shortTypeName=sType.replace(/on/,"");
        fHandler._ieEmuEventHandler=function(e){
            window.event=e;
            return fHandler();
            }
        this.addEventListener(shortTypeName,fHandler._ieEmuEventHandler,false);
    }    
};

$(function() {$('.lbx').lightBox({fixedNavigation:true});});


$(document).ready(function() {
	$("a.anchorLink").anchorAnimate()
});

jQuery.fn.anchorAnimate = function(settings) {
 	settings = jQuery.extend({speed : 1100}, settings);	
	return this.each(function(){
		var caller = this;
		$(caller).click(function (event) {	
			event.preventDefault();
			var locationHref = window.location.href;
			var elementClick = $(caller).attr("href");			
			var destination = $(elementClick).offset().top-150;
			$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, settings.speed, function() {
				//window.location.hash = elementClick;
			});
		  	return false;
		})
	})
}
