function doRedirect(url, msg)
{
   var TARG_ID = "redirect_time_val";
   var MESS_ID = "redirect_time_mess";
   var DEF_MSG = "Redirecting...";

   if( ! msg ) { msg = DEF_MSG; }
   if( ! url ) { throw new Error('doRedirect() error: no "url" parameter'); }

   var e = document.getElementById(TARG_ID);
   if( ! e ) { throw new Error('doRedirect() error: element id of counter not found'); }
   var m = document.getElementById(MESS_ID);
   if( ! m ) { throw new Error('doRedirect() error: element id for message not found'); }

   var cTicks = parseInt(e.innerHTML);

   var timer = setInterval(function()
   {
      if( cTicks )
      {
	 cTicks = cTicks - 1;
	 e.innerHTML = cTicks;
      }
      else
      {
	 clearInterval(timer);
	 m.innerHTML = msg;
		 document.location = url;
      }

   }, 1000);
}

function image_show(in_URL, in_WIDTH, in_HEIGHT) {
	var set_win_WIDTH = in_WIDTH + 26;
	var set_win_HEIGHT = in_HEIGHT + 16;

	// Getting screen size
	if (screen && screen.width && screen.height && screen.width > 0 && screen.height > 0) {
		var X_space = 100;
		var Y_space = 150;
		var max_X = screen.width - X_space;
		var max_Y = screen.height - Y_space;
		if (set_win_WIDTH > max_X) set_win_WIDTH = max_X;
		if (set_win_HEIGHT > max_Y) set_win_HEIGHT = max_Y;
	}
	eval('window.open("/wp-content/themes/theme_WC/image.php?path='+in_URL+'&width='+in_WIDTH+'&height='+in_HEIGHT+'", "show", "width='+set_win_WIDTH+',height='+set_win_HEIGHT+', menubar=0, status=0, scrollbars=1, resizable=yes")');
}
/* DONATE */
function xGetElementById(e) {
	if(typeof(e)=='string') {
		if(document.getElementById) e=document.getElementById(e);
		else if(document.all) e=document.all[e];
		else e=null;
	}
	return e;
}
function donate_check() {
	var b_skip_check = false;

	if (b_skip_check) return true;
	var obj_donate_amount = xGetElementById('donate_amount');
	if (obj_donate_amount) {
		//if(obj_donate_amount.value.indexOf('.') >= 0 && obj_donate_amount.value.indexOf('.00') < 0) {
		if(obj_donate_amount.value != parseInt(obj_donate_amount.value)) {
			alert('Sorry, but we can only accept donations in whole amounts.');
			return false;
		}
		if (!(obj_donate_amount.value > 0)) {
			alert('Sorry, but we can only accept donations in whole amounts \'> 0\'.');
			return false;
		}
	}
	return true;
}
