var ScrollLinks = {
	currentHash: false,
	start: function(){
		this.scroll = new fx.Scroll({duration: 1500, transition: fx.sineOut, onComplete: function(){this.end();}.bind(this)});
		this.allinks = $c(document.getElementsByTagName('a'));
		this.allinks.each(function(lnk){
			if ((lnk.href && lnk.href.indexOf('#') != -1) && ( (lnk.pathname == location.pathname) 
				|| ('/'+lnk.pathname == location.pathname) ) && (lnk.search == location.search)) {
				lnk.onclick = function(){
					ScrollLinks.scroll.clearTimer();
					this.initialHref = this.href;
					this.initialHash = this.hash;
					this.href = "javascript:void(0)";
					setTimeout(function(){this.href = this.initialHref;}.bind(this), 200);
					ScrollLinks.go(this);
				}
			}
		});
	},

	go: function(link){
		this.currentHash = link.initialHash.slice(1);
		if (this.currentHash) {
			this.allinks.each(function(lnk){
				if (lnk.id == ScrollLinks.currentHash){
					if (window.opera) lnk =  [lnk].find('parentNode');
					ScrollLinks.scroll.scrollTo(lnk);
					return;
				}
			});
		}
	},

	end: function(){
		if (!/Konqueror|Safari|KHTML/.test(navigator.userAgent)) window.location.hash = "#"+this.currentHash;
		this.currentHash = false;
	}
}

function loaddemo()
{
		var fo = new FlashObject("/flash/videodemo/video_demo.swf", "demoflash", "360", "270", "8", "#1a1a1a");
		fo.write("demoflash");
}


var win = null;
function NewWindow(mypage,myname,w,h,pos,infocus){
	if(pos == "random"){
		myleft = (screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
		mytop = (screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
	}
	if(pos == "center"){
		myleft = (screen.width)?(screen.width-w)/2:100;
		mytop = (screen.height)?(screen.height-h)/2:100;
	}
	else if((pos!='center' && pos!="random") || pos==null){
		myleft = 0;
		mytop = 20;
	}
	settings = "width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no";win=window.open(mypage,myname,settings);
	win.focus();
}


function popUpEmpty(){
	var elurl = "about:blank" ;
	NewWindow(elurl,'popUp','500','300','center','front');
}