function createWatch(){
	// do the same with a callback:
	$('watchform').request({
		method: 'get',
		 onLoading: function(transport){
			document.getElementById("infodiv").innerHTML = 'Creating watch.....';
		 },		
	    onComplete: function(){},
	    onSuccess: function(t) {
		    $('infodiv').update(t.responseText);
            document.getElementById("infodiv").style.display = 'block';
            Modalbox.resizeToContent();
        }
	})
}

function makeTrade(){
	var qty = document.getElementById("quantity").value;
	qty = qty.replace("+","");
	document.getElementById("quantity").value = qty;
	   
	if(isValidNumber(qty)){
		$('orderform').request({
			method: 'get',
			 onLoading: function(transport){
				document.getElementById("infodiv").innerHTML = 'Placing Order ......';
				document.getElementById("infodiv").style.display = 'block';
			 },		
		    onComplete: function(){  },
		    onSuccess: function(t) {
	            $('infodiv').update(t.responseText);
	            document.getElementById("infodiv").style.display = 'block';
	            Modalbox.resizeToContent();
	        }
		})
	} else {
		alert('Please enter valid Quantity');
	}
}

function isValidNumber(inpString) {
	   //return /^[-+]?\d+(\.\d+)?$/.test(inpString);
	   
	   if(inpString <= 0 ){
		   return false;
	   }
	   if(isNaN(inpString)){
		   return false;	
	   }
	   if(inpString.indexOf(".") != -1){
		   return false;
	   }
	   return true;
}


function showNextOpenPos(url,div) {
	if(url == "#"){
		return;
	}	
	new Ajax.Request(url,
	  {
	    method:'get',
	    onLoading: function(transport){
			document.getElementById(div).innerHTML = 'Loading......';
		},
	    onSuccess: function(transport){
	      	document.getElementById(div).innerHTML = transport.responseText;	      
	    },
	    onFailure: function(){ alert('Something went wrong...') }
	  });
}

function delete1() {
	alert("Sure want to delete this filter?");
}

