//
var thePlayer;
var w = 410;
var h = 360;
//
//
function openPlayer(){
	if(thePlayer && !thePlayer.closed){
		thePlayer.focus();
	} else {
		thePlayer = window.open("player/", "player", "status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=0,scrollbars=0,width="+w+",height="+h+",left="+Math.round((screen.availWidth-w)/2)+",top="+Math.round((screen.availHeight-h)/2));
	}
}
function makeSamplers(){
	divs = document.getElementsByClassName("sampler");
	for(k=0; k<divs.length; k++){
		div = divs[k];
		flashvars = {mp3Src:"_samples/"+div.id+".mp3"};
		params = {wmode:"transparent"};
		swfobject.embedSWF('_swf/sampler.swf', div.id, '26', '12', '8.0.0', null, flashvars, params);
	}
}
document.getElementsByClassName = function(cl) {
	var retnode = [];
	var myclass = new RegExp('\\b'+cl+'\\b');
	var elem = this.getElementsByTagName('*');
	for (var i = 0; i < elem.length; i++) {
		var classes = elem[i].className;
		if (myclass.test(classes)) retnode.push(elem[i]);
	}
	return retnode;
};

function id(eid){
	return document.getElementById(eid);
}
function cookiesActive(){
	if(!document.cookie){
		document.cookie = "cookie=";
		if(!document.cookie){
			return false;
		}
	}
	return true;
}
function setCookie(name, val){
	if(document.cookie.length){
		cookie = document.cookie.split("||");
		var index;
		for(i=0; i<cookie.length; i++){
			if(cookie[i].indexOf(name+"//") > -1){
				index = i;
				break;
			}
		}
		if(index || index == 0){
			cook = cookie[index].split("//");
			cook[1] = val;
			cook = cook.join("//");
			cookie[index] = cook;
		} else {
			cookie.push(name+"//"+val);
		}
		document.cookie = cookie.join("||");
	} else {
		document.cookie = "cookie="+name+"//"+val+"||";
	}
}
function getCookie(name){
	if(document.cookie.length){
		cookie = document.cookie.split("||");
		for(i=0; i<cookie.length; i++){
			if(cookie[i].indexOf(name+"//") > -1){
				return cookie[i].split("//")[1];
			}
		}
	}
	return null;
}
function deleteCookie(name){
	if(document.cookie.length){
		cookie = document.cookie.split("||");
		for(i=0; i<cookie.length; i++){
			if(cookie[i].indexOf(name+"//")){
				cookie.splice(i, 1);
				document.cookie = cookie.join("||");
				break;
			}
		}
	}
}
