function setcenter(obj)
{
		center(obj);
	   $(window).scroll(function(){
		center(obj);
	   });
	   $(window).resize(function(){
		center(obj);
	   });
}
	


function center(obj){
	 var windowWidth = document.documentElement.clientWidth;  
	 var windowHeight = document.documentElement.clientHeight;  
	 var popupHeight = $(obj).height();  
	 var popupWidth = $(obj).width();   
	 $(obj).css({  
	  "position": "absolute",  
	  "top": (windowHeight-popupHeight)/2+$(document).scrollTop()+50,  
	  "left": windowWidth-popupWidth -45
	 }); 
	}

var tempi=1;



$(function(){	
		   
	$('a').bind('focus',function(){
                if(this.blur){
                        this.blur();
                };
        	});	
	
	jQuery.showSubMenu(".menu li","ul");
	
	
	
	
	$(".smallbannerimg img").hover(function(){	
		 var img=$(this).attr("rel");
		 $("#bannerimg").css("opacity",0).css("top",0).attr("src",img);
		 $("#bannerimg").stop().animate({top: 0, opacity: '1' }, { duration: 800});
	},
	function(){
		
	})		
	
	
	
	setTimeout("showImg()",5000);  
	


})	



function showImg()
{
	var img=$(".smallbannerimg img:eq("+tempi+")").attr("rel");
	$("#bannerimg").css("opacity",0).css("top",0).attr("src",img);		
	$("#bannerimg").stop().animate({top: 0, opacity: '1' }, { duration: 800});
	tempi++;
	if(tempi==4)
	{
		tempi=0;
	}
	setTimeout("showImg()",5000);  
}


jQuery.extend({
	showSubMenu:function(parentnave,subdivname){

		$(parentnave).hover(function()
		{					
			$(this).find(subdivname).css("left",$(this).position().left);
			
			$(this).find(subdivname).css("top",$(this).position().top+31);
			
			$(this).find(subdivname).show();

			
		},				
		function()
		{
			$(this).find(subdivname).hide();

		});
	}
}); 




function goPage(url)
{
	window.location.href=url + $("#page").val();
}


$(function(){
		$("a.imgshow").fancybox();	
		 setcenter($("#floatdiv"));
		   jQuery("#scrollContent").jScrollPane();

	})
	



var xPos = 20;  
var yPos = 400;  
var step = 1;  
var delay = 30;  
var height = 0;  
var Hoffset = 0;  
var Woffset = 0;  
var yon = 0;  
var xon = 0;  
var pause = true;  
var interval;
$("#img").css("top",yPos) ;  
function changePos() {  
	width = document.body.clientWidth;  
	height = document.body.clientHeight;  
	Hoffset = $("#img").height();  
	Woffset = $("#img").width();  
	$("#img").css("left",xPos + document.body.scrollLeft) ;  
	$("#img").css("top",yPos + document.body.scrollTop) ;  
	if (yon) {  
		yPos = yPos + step;  
	}  
	else {  
		yPos = yPos - step;  
	}  
	if (yPos < 0) {  
		yon = 1;  
		yPos = 0;  
	}  

	if (yPos >= (height - Hoffset)) {  
		yon = 0;  
		yPos = (height - Hoffset);  
	}  
	if (xon) {  
		xPos = xPos + step;  
	}  
	else {  
		xPos = xPos - step;  
	}  
	if (xPos < 0) {  
		xon = 1;  
		xPos = 0;  
	}  
	if (xPos >= (width - Woffset)) {  
		xon = 0;  
		xPos = (width - Woffset);  
	}  
}  
function start() {  
$("#img").visibility = "visible";  
interval = setInterval('changePos()', delay);  
}  
start();  



