// JavaScript Document
function $( name ){
	return document.getElementById( name );
}

function confirmAction(){
	if( confirm( "Are you sure you want to do this?" ) ) return true;
	else return false;
}

function delegate( that, thatMethod ){
    return function() { return thatMethod.call(that, arguments ); }
    //return function() { return thatMethod.apply(that, arguments ); }
}

function registerClearDefault( inpt, defTxt ){
	inpt.onfocus = function(){ inptClearDefault( inpt, true, defTxt ); }
	inpt.onblur = function(){ inptClearDefault( inpt, false, defTxt ); }
}

function inptClearDefault( inpt, isfocus, txt ){
	if( isfocus ){
		if( inpt.value == txt ) inpt.value = "";
	}else{
		if( inpt.value == "" ) inpt.value = txt;
	}
}

function popDownload( id ){
	var strWidth = 400;//560;
	var strHeight = 420;//295;
	var leftStr = (screen.width-strWidth)/2;
	var topStr = (screen.height-strHeight)/2-100;
	windowProperties = "toolbar=no,menubar=no,titlebar=no,directories=no,fullscreen=no,scrollbars=no,statusbar=no,status=no,location=no,resizable=no,height="+strHeight+",width="+strWidth+",left="+leftStr+",top="+topStr;
	window.open( "/pop-download-theme?id=" + id,'themeDownload',windowProperties);
}
