// JavaScript Document

function rusure(thereg){
	var j;
	var valueDelete = new Array();
	val = document.forms["myForm"].elements.length;
	j=0;
	for(i=1; i<val; i++)
	{
			if (document.forms["myForm"].elements[i].checked==1) 
			{
				j = j + 1;
				//value = document.forms["myForm"].elements[i].value;
				valueDelete[j] = document.forms["myForm"].elements[i].value;
			}
	}
	if (j==0) 
	{
		alert('Please check one of items!');
	}
	if (j==1) 
	{
		question = confirm("Are you sure want to delete this item ?");
		if (question !="0")
		{
			top.location = thereg + "&id=" + valueDelete[1] ;
		}
	}
	if (j>1) {
		//alert('Please don`t check more than one items!');
		question = confirm("Are you sure want to delete this items ?");
		if (question !="0")
		{
			queryString = thereg;
			for(i=1; i<=j; i++)
			{
				//top.location = thereg + "&id=" + value ;
				queryString = queryString + "&id" + i + "=" + valueDelete[i];
			}
			queryString = queryString + "&count=" + j;
			top.location = queryString;
		}
	}
	
}

function rusure2(thereg){
	var j;
	val = document.forms["myForm"].elements.length;
	j=0;
	for(i=1; i<val; i++)
	{
			if (document.forms["myForm"].elements[i].checked==1) 
			{
				j = j + 1;
				value = document.forms["myForm"].elements[i].value;
			}
	}
	if (j==0) 
	{
		alert('Please check one of items!');
	}
	if (j==1) 
	{
		document.myForm.submit();
	}
	if (j>1) 
	{
		//alert('Please don`t check more than one items!');
		document.myForm.submit();
	}
	
}

function rusure3(thereg){
	question = confirm("are you sure?")
	if (question !="0"){
		top.location = thereg 
	}
	
}


