h242.include('mousepos.js');

h242.include('scrt/scriptaculous.js');
h242.include('scrt/litbox.js');
h242.include('scrt/EventSelectors.class.js');
h242.include('scrt/EventRules.class.js');

h242.include('ajax/srajax.js');
h242.include('ajax/srajax_events.js');
h242.include('ajax/multifile.js');

function isBlank(val){if(val==null){return true;}for(var i=0;i<val.length;i++){if((val.charAt(i)!=' ')&&(val.charAt(i)!="\t")&&(val.charAt(i)!="\n")&&(val.charAt(i)!="\r")){return false;}}return true;}
function isInteger(val){if(isBlank(val)){return false;}for(var i=0;i<val.length;i++){if(!isDigit(val.charAt(i))){return false;}}return true;}
function isNumeric(val){return(parseFloat(val,10)==(val*1));}
function isArray(obj){return(typeof(obj.length)=="undefined")?false:true;}
function isNull(val){return(val==null);}
function isDigit(num){if(num.length>1){return false;}var string="1234567890";if(string.indexOf(num)!=-1){return true;}return false;}


function isset(varname) {
	return undefined !== window[varname];
}

// photo swapper
var divs_to_fade = new Array('trp1','trp2');
var photos = new Array('trp_photo1','trp_photo2');
var i = 0;
function swapFade() {
	Effect.Fade(divs_to_fade[i], { duration:1, from:1.0, to:0.0 });
	SRAjax.requestString(ROOT_URL+'/_includes/ajax/photorotate.php','',function(xhr) {
		i = i == 0 ? 1 : 0;
		$(photos[i]).src = ROOT_URL+'/templates/book/_images/rotate/'+xhr.responseText+'.jpg';
		Effect.Appear(divs_to_fade[i], { duration:1, from:0.0, to:1.0 });						
   });
}

function falsify(msg) {
	new LITBox('<div style="padding: 1em; text-align: center;">'+msg+'</div>',{type: 'alert', overlay: true, width: 330, height: 170});
	return false;
}

function showPicture(photo,title,w,h) {
	if (w > 800) { w = 800; }
	if (h > 800) { h = 800; }
	new LITBox('<div style="margin: auto; text-align: center;"><img src="'+photo+'" alt="" /><br style="height: 1px" /><h2>'+title+'</h2></div>',{type: 'alert', overlay: true, width: (w+60), height: (h+70)});
}

function showPic(photo,title,w,h) {

	if (w > 800) { w = 800; }
	if (h > 800) { h = 800; }
	
	new LITBox('<div style="margin: auto; text-align: center;"><img src="'+photo+'" alt="" /><br style="height: 1px" /><h2>'+title+'</h2></div>',{type: 'alert', overlay: true, width: (w+60), height: (h+70)});
}