Event.observe(window, 'load', function() {
		cssQuery('a.link_del').each(
			function(item){
				new Insertion.Top(item.parentNode, '&nbsp;');
				item.onclick = function() {
					if(confirm("Are you sure you would like to delete this Entry?\n There is NO undelete.")) {
						//this.href = this.href + '/allow'; 
						$id = this.href.split("/");
						$id.reverse();
						$id = $id[0];
						
						
						
						if($('formdeleter')) Element.remove('formdeleter');
						new Insertion.Bottom(cssQuery('body')[0], '<form method="post" id="formdeleter" action="'+this.href+'"><input type="hidden" name="__id" value="'+$id+'" /></form>');
						
						$('formdeleter').submit();
						return false;	
						
					}else{
						return false;
					}
				}
			}
		);
		
		
		
		cssQuery('select.pagerdrop').each(
				function(item) {
					if(item.options[0].value == '') item.options[0] = null;
					item.onchange = function() {
						pagename = 'beg';
						if(this.getAttribute('rel')) pagename = this.getAttribute('rel');
						i = 0;
						url = window.location.href;
						url_ = url.split("?");
						pageinurl = false;
						pageinurl_ = 0;
						url__ = url_[1].split("&");
						url__.each(
							
								function(url, i){
									temp = url.split("=") 
									if(temp[0] == pagename){
										pageinurl = true; 
										pageinurl_ = i;
										return;
									}
								}
							);
						if(pageinurl){
							url__[pageinurl_] = pagename + "=" + this.value;
							
						}else{
							
							l = url__.length; 
							url__[l++] = pagename + "=" + this.value;
							
							
						}
						url_[1] = url__.join("&");
						newurl = url_.join("?");
						window.location.href = newurl; 
						
					}
				}
		);
		


		cssQuery('select.typedrop').each(
				function(item) {
					if(item.options[0].value == '') item.options[0] = null;
					item.onchange = function() {
						pagename = 'id';
						if(this.getAttribute('rel')) pagename = this.getAttribute('rel');
						i = 0;
						url = window.location.href;
						url_ = url.split("?");
						pageinurl = false;
						pageinurl_ = 0;
						url__ = url_[1].split("&");
						url__.each(
							
								function(url, i){
									temp = url.split("=") 
									if(temp[0] == pagename){
										pageinurl = true; 
										pageinurl_ = i;
										return;
									}
								}
							);
						if(pageinurl){
							url__[pageinurl_] = pagename + "=" + this.value;
							
						}else{
							
							l = url__.length; 
							url__[l++] = pagename + "=" + this.value;
							
							
						}
						url_[1] = url__.join("&");
						newurl = url_.join("?");
						window.location.href = newurl; 
						
					}
				}
		);
		cssQuery('select.typedrop1').each(
				function(item) {
					if(item.options[0].value == '') item.options[0] = null;
					item.onchange = function() {
						pagename = 'cust_id';
						if(this.getAttribute('rel')) pagename = this.getAttribute('rel');
						i = 0;
						url = window.location.href;
						url_ = url.split("?");
						pageinurl = false;
						pageinurl_ = 0;
						url__ = url_[1].split("&");
						url__.each(
							
								function(url, i){
									temp = url.split("=") 
									if(temp[0] == pagename){
										pageinurl = true; 
										pageinurl_ = i;
										return;
									}
								}
							);
						if(pageinurl){
							url__[pageinurl_] = pagename + "=" + this.value;
							
						}else{
							
							l = url__.length; 
							url__[l++] = pagename + "=" + this.value;
							
							
						}
						url_[1] = url__.join("&");
						newurl = url_.join("?");
						window.location.href = newurl; 
						
					}
				}
		);
	}, true);
	
function check(str, val){
	temp = cssQuery('input#' + str)[0];
	if((temp.checked == false) && (val == true)){
		temp.checked = true;
	}
}
function checker_all(){
	temp = cssQuery('input.checker_a')[0];
	if(temp.checked == true){
		i = 0;
		cssQuery('input.checker_a').each(
                        function(item){
				cssQuery('input.checker_a')[i].checked = true;
				i++;
			}
                );
	}else{
		i = 0;
		cssQuery('input.checker_a').each(
                        function(item){
                                cssQuery('input.checker_a')[i].checked = false;
                                i++;
                        }
                );
	}
}
function updateAjax(){
	var temp = cssQuery('select#sup_dyna')[0];
	var url = 'index.php?cont=Purchasing&child=Receiving%20Report&method=supdet_ajax&id=' + temp.value;
	var pars = null;
	var myAjax = new Ajax.Updater( 'dyna1', url, { method: 'get', parameters: pars });
}
function modelesswin(url,mwidth,mheight){
	if (document.all&&window.print) //if ie5
		eval('window.showModelessDialog(url,"_blank","help:0;resizable:1;dialogWidth:'+mwidth+'px;dialogHeight:'+mheight+'px")')
	else
		eval('window.open(url,"","width='+mwidth+'px,height='+mheight+'px,resizable=1,scrollbars=1")')
}
function confirmDelete()
{
    var agree=confirm("Are you sure you want to delete this entry?");
    if (agree)
        return true;
    else
        return false;
}
function confirmReset()
{
    var agree=confirm("Are you sure you want to the password of this entry?");
    if (agree)
        return true;
    else
        return false;
}
function confirmUnsubscibed()
{
    var agree=confirm("Are you sure you want to unsubscribed this user?");
    if (agree)
        return true;
    else
        return false;
}
function confirmUnblocked()
{
    var agree=confirm("Are you sure you want to unblocked this user?");
    if (agree)
        return true;
    else
        return false;
}
function confirmBlocked(numero)
{
	var agree=prompt("Please give reason why you want to blocked this number(" + numero + ")", "");
    if (agree){
		var url = 'index.php?cont=Subscriber&child=Subscriber Profile&method=addentry_block_ajax&number=' + numero + '&remarks=' + agree;
		var pars = null;
		var myAjax = new Ajax.Request( url, {method:'get', onComplete: function res(){alert("Number Successfully blocked"); window.location.reload( false );}});
        return true;
    }else{
        return false;
	}
}
function confirmReversed()
{
    var agree=confirm("Are you sure you want to set this for reversal?");
    if (agree)
        return true;
    else
        return false;
}
function window_rel(str)
{
	window.location = str;
}
function radioCheck(par){
	if(par == '0'){
		i = 0;
		cssQuery('input.date_form').each(
                        function(item){
                                cssQuery('input.date_form')[i].disabled = false;
                                i++;
                        }
                );
		i = 0;
		cssQuery('select.date_form').each(
                        function(item){
                                cssQuery('select.date_form')[i].disabled = false;
                                i++;
                        }
                );
	}else{
		i = 0;
		cssQuery('input.date_form').each(
                        function(item){
                                cssQuery('input.date_form')[i].disabled = true;
                                i++;
                        }
                );
		i = 0;
		cssQuery('select.date_form').each(
                        function(item){
                                cssQuery('select.date_form')[i].disabled = true;
                                i++;
                        }
                );
	}
}
function dropCheck(par){
	if(par == '0'){
		
		i = 0;
		cssQuery('input.date_form').each(
                        function(item){
                                cssQuery('input.date_form')[i].disabled = false;
                                i++;
                        }
                );
		i = 0;
		cssQuery('select.date_form').each(
                        function(item){
                                cssQuery('select.date_form')[i].disabled = false;
                                i++;
                        }
                );
		i = 0;
		cssQuery('input.drop_form').each(
                        function(item){
                                cssQuery('input.drop_form')[i].disabled = true;
                                i++;
                        }
                );
		i = 0;
		cssQuery('select.drop_form').each(
                        function(item){
                                cssQuery('select.drop_form')[i].disabled = true;
                                i++;
                        }
                );
	}else{
		i = 0;
		cssQuery('input.date_form').each(
                        function(item){
                                cssQuery('input.date_form')[i].disabled = true;
                                i++;
                        }
                );
		i = 0;
		cssQuery('select.date_form').each(
                        function(item){
                                cssQuery('select.date_form')[i].disabled = true;
                                i++;
                        }
                );
		i = 0;
		cssQuery('input.drop_form').each(
                        function(item){
                                cssQuery('input.drop_form')[i].disabled = false;
                                i++;
                        }
                );
		i = 0;
		cssQuery('select.drop_form').each(
                        function(item){
                                cssQuery('select.drop_form')[i].disabled = false;
                                i++;
                        }
                );
	}
}
function dropCheck1(par){
	if(par == 'Summary'){
		
		i = 0;
		cssQuery('input.rad').each(
                        function(item){
                                cssQuery('input.rad')[i].disabled = false;
                                i++;
                        }
                );
	}else{
		i = 0;
		cssQuery('input.rad').each(
                        function(item){
                                cssQuery('input.rad')[i].disabled = true;
                                i++;
                        }
                );
	}
}
function blockAjax(mob_num){
	var temp = cssQuery('input#center_fence')[0];
	alert(temp);
	var url = 'index.php?cont=Subscriber&child=Subscriber Profile&method=addentry_block&';
	var pars = null;
	var myAjax = new Ajax.Request( url, {onSuccess: alert("Number Successfully blocked")});
}
function targetopener(mylink, closeme, closeonly){
	if (! (window.focus && window.opener))return true;
		window.opener.focus();
	if (! closeonly)
		window.opener.location.href=mylink.href;
	if (closeme)window.close();
	return false;
}
function wagerType(value){
	if(value == 3){
		cssQuery('input.poste')[0].disabled = false;
		cssQuery('input.poste')[1].disabled = true;
	}else if(value == 4){
		cssQuery('input.poste')[0].disabled = false;
		cssQuery('input.poste')[1].disabled = false;
	}else{
		cssQuery('input.poste')[0].disabled = true;
		cssQuery('input.poste')[1].disabled = true;
	}
}
function dropUpdate(val){
	var url = 'index.php?cont=Admin&child=Terminals&method=addentry_ajax&id=' + val;
	var pars = null;
	var myAjax = new Ajax.Updater( 'dynadiv', url, { method: 'get', parameters: pars });
}


