function Checkbox_check()
{
	
	// assigh the name of the checkbox;
	var chks = document.getElementsByName('cbShape[]');

	var val='';
	var hasChecked=0;
	// Get the checkbox array length and iterate it to see if any of them is selected
	if(chks[0].checked){
		$('#cut_table').show();
	}
	else{
		$('#cut_table').hide();
	}
	
	
	for (var i = 0; i < chks.length; i++)
	{
			if (chks[i].checked)
			{
					val+=chks[i].value+',';
					hasChecked++;
			}
	}
	if(hasChecked==0)
	{
		
		return false;
	}
	// if hasChecked is false then throw the error message
	
	document.getElementById('selected_shape').value=val;
	
	LoadResults();
	
}
        
function Certif_check()
{
	
	// assigh the name of the checkbox;
	var chks = document.getElementsByName('certif[]');

	var val='';
	var hasChecked=0;
	// Get the checkbox array length and iterate it to see if any of them is selected
	for (var i = 0; i < chks.length; i++)
	{
			if (chks[i].checked)
			{
					val+=chks[i].value+',';
					hasChecked++;
			}
	}
	if(hasChecked==0)
	{
		
		return false;
	}
	// if hasChecked is false then throw the error message
	
	document.getElementById('hdncertificate').value=val;
	
	LoadResults();
	
}
		
function SetLeftPriceValue() {
	var val = document.getElementById('txtPriceLeft').value;
	if(val!='')
	{
		if(isNaN(val))
		{
			alert("Please enter a valid value for the price range");	
		}
		else
		{
			document.getElementById('hdnPriceLeft').value = val;
			LoadResults();
		}
	}

}
function SetRightPriceValue() {
	var val = document.getElementById('txtPriceRight').value;
	if(val!='')
	{
		if(isNaN(val))
		{
			alert("Please enter a valid value for the price range");	
		}
		else
		{
			document.getElementById('hdnPriceRight').value = val;
			LoadResults();
		}
	}
}

function SetLeftSizeValue() {
	var val = document.getElementById('txtSizeLeft').value;
	if(val!='')
	{
		if(isNaN(val))
		{
			alert("Please enter a valid value for the size range");	
		}
		else
		{
			document.getElementById('hdnSizeLeft').value = val;
			LoadResults();
		}
	}
}
function SetRightSizeValue() {
	var val = document.getElementById('txtSizeRight').value;
	if(val!='' && val!='.')
	{
		if(isNaN(val))
		{
			alert("Please enter a valid value for the size range");	
		}
		else
		{
			document.getElementById('hdnSizeRight').value = val;
			LoadResults();
		}
	}
}
function paging_click(page_id){ 
	$('#cur_page').val(page_id);
	LoadResults();
}

function OnLoad() {
	var ImageFolderPath = document.getElementById('hdnImageFolderPath').value;
	

	$('.SliderBowleft').each(function (i, n) {
		this.src = ImageFolderPath + "SliderBowleft.gif";
	});
	$('.SliderBowRight').each(function (i, n) {
		this.src = ImageFolderPath + "SliderBowRight.gif";
	});


	
	

   LoadResults();

}


function show(div,top_value)
{
	var IE = document.all?true:false;
	if (!IE) document.captureEvents(Event.MOUSEMOVE)
	document.onmousemove = getMouseXY;
	
	var tempY = 0;
	function getMouseXY(e) {
	if (IE) { // grab the x-y pos.s if browser is IE
	
	tempY = event.clientY + document.body.scrollTop;
	tempX = event.clientX + document.body.scrollLeft;
	}
	else {  // grab the x-y pos.s if browser is NS
	
	tempY = (e.pageY*1) ;
	tempX = (e.pageX*1) ;
//	alert(e.screenY);
	}  
	
	if (tempY < 0){tempY = 0;}  
	if (tempX < 0){tempX = 0;} 
	document.getElementById(div).style.top = tempY+"px";
	document.getElementById(div).style.left = (tempX+10)+"px";
	}
	
	$('#'+div+'').show();
	
}
function hide(div)
{
	$('#'+div+'').hide();	
}

function change_col(col,order_by)
{
	var coloumn_sel=document.getElementById("coloumn_sel").value;
	if(col===coloumn_sel)
	{
		
		if(order_by=='asc')
		{
			document.getElementById("orderin").value='desc';
		}
		else
		{
			document.getElementById("orderin").value='asc';
		}
	}
	else
	{
		document.getElementById("coloumn_sel").value=col;
		document.getElementById("orderin").value='asc';
		
	}
	LoadResults();
}

