

function shortcover_share(menu) {

//alert('dsafdsa');
ref=menu.choice.options[menu.choice.selectedIndex].value;
ref=menu.choice.options[menu.choice.selectedIndex].value;
if(ref=='')
{
get$('shortcover_content2').innerHTML = "";
get$('shortcover_content1').innerHTML = "";
} 
else
{
//alert(ref);
	//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 ss = ref.split("##");
      var str = "companyid="+ss[0]+"&shareprice="+ss[1];
	  var q="?q="+new Date().getTime();
	  url = "shortcover_share.php"+q;
	  http_request.onreadystatechange = shortcover_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 shortcover_contents() {
   
      if (http_request.readyState == 4) {
	  				
        get$("shortcover_content1").innerHTML= http_request.responseText;
		get$('shortcover_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;&nbsp;&nbsp;&nbsp;</td><td colspan='6' align='center'> <br><br><input name='submit' type='submit'  value=' ShortCover '><p></td></tr></table>";
	
        } else {
		 }
      
   }
   

   function shortcover_radio(radio)
 {
 if(radio =='market_shortcover' )
    {
	 get$('shortcover_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;&nbsp;&nbsp;&nbsp;</td><td colspan='6' align='CENTER'> <br><br><input name='submit' type='submit'  value=' ShortCover '><p></td></tr></table>";

 	}
 else if(radio == 'bid_shortcover')
  {
	get$('shortcover_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=' ShortCover '>&nbsp;&nbsp;<input type='text' name='shortcover_bidvalue' id='shortcover_bidvalue' size=10>(Bid Price)<p></td></tr></table>";

 }	  
   
}	





function shortcovered() {
  
	  http_request=GetXmlHttpObject();
	if (http_request==null)
 {
 alert ("Browser does not support HTTP Request");
 return
 } 
 var str="";
  if(get$('shortcover_bidvalue')){    
      var str = "share_no="+get$('shortcovershare_no').value+"&bid_price="+document.getElementById('shortcover_bidvalue').value+"&companyid="+document.getElementById('shortcover_companyid').value+"&share_price="+document.getElementById('shortcovershare_price').value;
	 //alert("bye");
	 }
	 else
	 {
	 var str = "share_no="+get$('shortcovershare_no').value+"&bid_price=na&companyid="+document.getElementById('shortcover_companyid').value+"&share_price="+document.getElementById('shortcovershare_price').value;
	 //alert("hi");
	 }
	// alert(str);
	   var q="?q="+new Date().getTime();
	  url = "shortcoversold.php"+q;
	  http_request.onreadystatechange = shortcoveredContents
	   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 shortcoveredContents() {
	   
      if (http_request.readyState == 4) {
	  var response = http_request.responseText;
	  if(response =='1')
	{
		user_refresh();
		get$('shortcover_content1').innerHTML = '<div align="center"><strong>Your Bid has been placed</strong>';
	}
	else if(response == '2')
	{
		user_refresh();
		get$('shortcover_content1').innerHTML = '<div align="center"><strong>Your transaction is completed</strong>';
	}
	else	
	{
		get$('shortcover_content3').innerHTML = response;
	}
	
	}      
   }
   
  
	




