// JavaScript Document
var isMSIE = /*@cc_on!@*/false;


function open_popin ( url, cl_name ) {
	//alert ( 'open_popin ( url:' + url + ', cl_name:' + cl_name + ' )' );
	if ( !cl_name ) cl_name = "ifr-default";
	document.getElementById ( "popin_ifr" ).className 		= cl_name;
	document.getElementById ( "popin_ifr" ).src 			= url;
	document.getElementById ( "popin_close" ).className 	= cl_name + "_closebtn";
	document.getElementById ( "popin_container" ).style.display 	= "block";
}
function close_popin () {
	document.getElementById ( "popin_ifr" ).src 	= "http://www.santobyzani.com/blank.php";
	document.getElementById ( "popin_container" ).style.display 	= "none";
}

// ---	div scrolling functions
//		set variables that are used by scroll_div function
var scroll_timeout;
var mask_id 	= "scroll_mask";		// ---	id of the <div> container that masks the scroll content
var scroll_id 	= "scroll_content";		// ---	id of the <div> containing the content to be scrolled
var btns_id 	= "scroll_btns";		// ---	id of the <div> that has the buttons used to call scroll_div function
var btn_up 		= "scroll_upbtn";
var btn_down 	= "scroll_downbtn";
function scroll_div ( dir, incr ) {
	//alert ( 'scroll_div ( dir:' + dir + ', incr:' + incr + ' )' );
	clearTimeout ( scroll_timeout );
	scroll_timeout 	= null;
	if ( dir != "stop" ) {
		// ---	get the mask height... the window that the content scrolls in
		var omask 	= document.getElementById ( mask_id );
		var maskh 	= omask.clientHeight;
		// ---	get the content height and y position of the scrolling layer
		var oscroll 	= document.getElementById ( scroll_id );
		var scrolly 	= Number ( oscroll.style.top.replace ( "px", "" ) );
		var scrollh 	= oscroll.clientHeight;
		// ---	buttons
		var obtns 	= document.getElementById ( btns_id );
		switch ( dir ) {
			case "init" :
				// ---	if there isn't anything to scroll, hide the buttons
				if ( maskh > scrollh ) {
					obtns.style.display 	= "none";
				} else {
					btn_up 		= document.getElementById ( btn_up );
					btn_up.onmouseover 	= function () { scroll_div ( 'up', 2 ) };
					btn_up.onmousedown 	= function () { scroll_div ( 'up', 10 ) };
					btn_up.onmouseup 	= function () { scroll_div ( 'up', 2 ) };
					btn_up.onmouseout 	= function () { scroll_div ( 'stop', 0 ) };
					btn_down 	= document.getElementById ( btn_down );
					btn_down.onmouseover 	= function () { scroll_div ( 'down', 2 ) };
					btn_down.onmousedown 	= function () { scroll_div ( 'down', 10 ) };
					btn_down.onmouseup 		= function () { scroll_div ( 'down', 2 ) };
					btn_down.onmouseout 	= function () { scroll_div ( 'stop', 0 ) };
				}
				break;
			case "up" :
				if ( scrolly < 0 ) 	oscroll.style.top = ( scrolly + incr ) + "px";
				else 				oscroll.style.top = "0px";
				break;
			case "down" :
				if ( scrolly > ( maskh - scrollh ) ) 	oscroll.style.top = ( scrolly - incr ) + "px";
				else 									oscroll.style.top = ( maskh - scrollh ) + "px";
				break;
		}
		if ( dir != "init" ) {
			// ---	keep the scroll going until dir = "stop"
			funct 			= "scroll_div('" + dir + "'," + incr + ");";
			scroll_timeout 	= setTimeout ( funct, 10 );
		}
	}
}

