

function shortsell_share(menu) {

//alert('dsafdsa');
ref=menu.choice.options[menu.choice.selectedIndex].value;
ref=menu.choice.options[menu.choice.selectedIndex].value;
if(ref=='')
{
get$('shortsell_content2').innerHTML = "";
get$('shortsell_content1').innerHTML = "";
} 
else
{
	//var http_request = false;
   //get$('content').innerHTML = '<b>Loading....</b><br><img src="images/regload.gif">';
      http_request=GetXmlHttpObject();
	if (http_request==null)
 {
 alert ("Browser does not support HTTP Request");
 return
 } 
 
      var str = "companyid="+ref;
	  var q="?q="+new Date().getTime();
	  url = "shortsell_share.php"+q;
	  http_request.onreadystatechange = shortsell_contents
	   http_request.open("POST",url,true);
      
	  http_request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	  http_request.setRequestHeader("Content-length", str.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(str);
	  }
   }

   function shortsell_contents() {
   
      if (http_request.readyState == 4) {
	  				
        get$('shortsell_content1').innerHTML= http_request.responseText;
		get$('shortsell_content2').innerHTML = "<tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td colspan='6' align='CENTER'><br><br><input name='submit'  type='submit'  value=' Shortsell'>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;<p></td></tr></font></table>";
			
        } else {
		 }
      
   }
  
function shortsell_radio(radio)
 {
 if(radio =='market' )
    {
	 get$('shortsell_content2').innerHTML = "<tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td colspan='6' align='CENTER'><br><br><input name='submit'  type='submit'  value=' Shortsell'>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; <p></td></tr></font></table>";
     
 	}
 else if(radio == 'bid')
  {
	get$('shortsell_content2').innerHTML = "<tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td colspan='6' align='CENTER'><br><br><input name='submit' type='submit'  value=' Shortsell'><input type='text' name='shortsellbid_price' id='shortsellbid_price' size=10>(Bid Price)&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; <p></td></tr></font></table>";

 }	  
   
}	
  
 function shortsellsold() {
  
	  http_request=GetXmlHttpObject();
	if (http_request==null)
 {
 alert ("Browser does not support HTTP Request");
 return
 } 
 var str="";
  if(get$('shortsellbid_price')){    
      var str = "share_price="+document.getElementById('share_price').value+"&shortsellbid_price="+document.getElementById('shortsellbid_price').value+"&companyid="+document.getElementById('companyid').value;
//	 alert("bye");
	 }
	 else
	 {
	 var str = "share_price="+document.getElementById('share_price').value+"&shortsellbid_price=na&companyid="+document.getElementById('companyid').value;
	// alert("hi");
	 }
	 //alert(str);
	   var q="?q="+new Date().getTime();
	  url = "shortsellsold.php"+q;
	  http_request.onreadystatechange = shortsellContents
	   http_request.open("POST",url,true);
      
	  http_request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	  http_request.setRequestHeader("Content-length", str.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(str);
   }

   function shortsellContents() {
   
      if (http_request.readyState == 4) {
	  var response = http_request.responseText;
	  var r = response.split("#");
	//alert(response+"dsaf");
		if(r[0] =='1')
		{
		user_refresh();
		get$('shortsell_content1').innerHTML = '<div align="center"><strong>Your Bid has been placed</strong>';
		}
		else if(r[0] == '2')
		{
			user_refresh();
			get$('shortsell_content1').innerHTML = '<div align="center"><strong>Your transaction is completed</strong>';
		}
		else	
		{
			get$('shortsell_content3').innerHTML = response;
		}
	
	
		
		
       }  else {
		 }
      
   }
   
  
 

