function yes_no(loc, message){
	if(message == null){
        message = '{{:yes_no_delete:}}';
	}
	if(confirm(message)){
        location.href = loc;
	}
}
function getPageSizeWithScroll(){
	if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight;
		xWithScroll = document.body.offsetWidth;
  	}
	arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
	document.getElementById('test_table').style.height = yWithScroll;
	document.getElementById('test_table').style.visibility = 'visible';
	scroll();
	//document.getElementById('test').innerHTML = csrollposition();

	//document.getElementById('test_table').style.width = 100#;
	//alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll );
	//return arrayPageSizeWithScroll;
}
function csrollposition() {
  return document.body.scrollTop;
}
function hide_table(){
	document.getElementById('test_table').style.visibility = 'hidden';
}

function show_hide(id){
    if(document.getElementById(id).style.visibility == 'hidden'){
    	document.getElementById(id).style.visibility = 'visible';
    	document.getElementById('search_select_img').src = 'images/btn_date1_down.gif';
    }
    else if(document.getElementById(id).style.visibility == 'visible'){
    	document.getElementById(id).style.visibility = 'hidden';
    	document.getElementById('search_select_img').src = 'images/btn_date1_up.gif';
    }
}
function select_cat(name, id){
    if(id > 0){
    	document.getElementById('ou_name').value = name;
    	document.getElementById('ou_id').value = id;
    	document.getElementById('search_cat').innerHTML = '';
    	show_hide('search_cat');
    }
    else if (id == 'all'){
    	document.getElementById('ou_name').value = '';
    	document.getElementById('ou_id').value = '';
    	document.getElementById('search_cat').innerHTML = '';
    	show_hide('search_cat');
    }
}
function timingex(page_src){
	//alert(csrollposition());
	document.getElementById('start_div').style.top = csrollposition() + 200;
	showform('user', this.value, ''+page_src+'', 'start_div');
	setInterval('showform("user", this.value, "'+page_src+'", "start_div")',60000);
}
function scroll(){
	//document.getElementById('test_table').style.visibility = 'visible';
	document.getElementById('start_div').style.top = csrollposition() + 100;
}

function chng_menu_img(id, name, type, cur){
	if(type == 'over'){
		document.getElementById('menu_img_'+id).src = 'blocks/menu/images/'+name+'_hover.jpg';
	}
	else if(type == 'out' && cur == 0){
		document.getElementById('menu_img_'+id).src = 'blocks/menu/images/'+name+'.jpg';
	}
}

function roundNumber(num) {
	var result = Math.round(num*Math.pow(10,2))/Math.pow(10,2);
	return result;
}

function product_amount(field_id, plus_minus, range, min_amount, max_amount, infinite, alert_text){
	calc_field = document.getElementById(field_id);
	if(plus_minus == 'plus'){
		if(roundNumber(max_amount) >= (roundNumber(calc_field.value) + roundNumber(range)) || parseInt(infinite) == 1){
			calc_field.value = roundNumber(roundNumber(calc_field.value) + roundNumber(range));
		}
		else{
			alert(alert_text);
		}
	}
	else if(plus_minus == 'minus'){
		if(roundNumber(min_amount) <= (roundNumber(calc_field.value) - roundNumber(range))){
			calc_field.value = roundNumber(roundNumber(calc_field.value) - roundNumber(range));
		}
		else{
			calc_field.value = min_amount;
		}
	}
}
