$(function(){
		$('#flickrImg').flickr({
			api_key: '53794fe4e3e2a58357541a8dd4730e81',
			type: 'search',
			//user_id: '34630936@N08',
			user_id: '52433592@N07',
			attr: 'class="lightBox"'
		});
		
		$('#loginCiSweb4').click(function(){
			showLogin($(this));
		})
		
		$('#closeLogin, #LoginBG').click(function(){
			$('#LoginBG, #loginBox').fadeOut()
		})
		
		$("#searchvalue").keydown(function(e){
		if(e.which==13){
			if($("#searchvalue").val()!="")
			window.location= DBName + "/SearchSite.xsp?SearchValue=" + $("#searchvalue").val();
			return false;
		}
		/*if($("#searchvalue").val().length>1){
		 
		$.ajax({
			url: DBName + "/(livesearchagent)?openAgent&query=" + $("#searchvalue").val(),
  			cache: false,
  			processData: false,
  		  	
  			success: function(xml){
  			   	liveSearch(xml);
  			}
  		})};*/
  	});
		
		if($.browser.msie){$('#nonFooter, #footer').css('display','block');}
		else {$('#nonFooter, #footer').fadeIn(500);}
		$('#searchvalue').click(function(){
			$(this).val('')
		});
		$('.topMargin60').parent().css('margin','44px 0 20px 0');
		$('#content').find('hr').each(function(){
			$(this).replaceWith('<div class="hr"></div>')
		});

        Cufon.replace('#content h1',{textShadow: '1px 1px rgba(255, 255, 255, 1)',fontStretch: '120%'});
        Cufon.replace('.infoBox h1, .infoBox span, #footer h1',{fontStretch: '120%'});
        
        //LOGIN
        
        $("#Login_Send").click(function(){
        
			$("#loginBox input").removeClass('error');
  			url="/names.nsf?login";
			txt= "&username=" + $("#LoginName").val() + "&password=" + $("#LoginPW").val()
	
			$.ajax({
			url: url + txt,
  			cache: false,
  			processData: false,
  		  	
  		  /*	error: function(html, textStatus, errorThrown){
  		  	alert(html.responseText)
  		  		//window.location= DBName + "/Portal.xsp";
  		  	},*/
  			success: function(html){
  	
  				if(html.search(/names.nsf/)== -1){
  					window.location.href= "/online/fdp/cisweb4_Biesok.nsf/allView.xsp"
  				}else{
  					$("#loginBox input").addClass('error');
  					$("#LoginName").val("");
  					$("#LoginPW").val("");
  				}
  			}
		});
	});
})

function initLB(){
	$('#flickrImg .loader').fadeOut();
	$('a.lightBox').lightBox();
};

function showLogin(a){
		$('#LoginBG').fadeTo(200,0.7)
		$('#loginBox').fadeIn()
		//a.attr('href','cisweb4_Biesok.nsf/allView.xsp')
		return false;
}
