// JavaScript Document

   <!-- 
   //Declaration of variables
    var WSHShell;
    var jamroom;
    //var jam;
    var jamroomtype;
    var durationleft;
    var user;
    var currentDate;
	var logindate;
    var logintime;
	var RegLoc;
	var RegLoc;
	RegLoc = "HKLM\\Software\\Ninjam\\";
	
	//Initialization of variables
	//Server Side Values jam				="<?//php echo $iP.':'.$Port; ?>";
	/*jamroom			="<?php //echo $iP.':'.$Port; ?>";
    jamroomtype		="<?php //echo $jamroomtype ?>";
    durationleft	="<?php //echo $durationleft ?>";
	user			="<?php //echo $user ?>";

//Client Side Values

	RegLoc	 		="HKLM\\Software\\Ninjam\\";
	WSHShell 		=new ActiveXObject("WScript.Shell");

	//ClearRegistryfromPage();
	//DeleteRegistryfromPage();
	//ResetRegistryfromPage();
	
	//Delete Old registry Values*/
    /*function DeleteRegistryfromPage() 
	{
		 WSHShell.RegDelete(RegLoc+"jamroom");
		 //WSHShell.RegDelete(RegLoc+"jam");
		 WSHShell.RegDelete(RegLoc+"jamroomtype");
		 WSHShell.RegDelete(RegLoc+"durationleft");
		 WSHShell.RegDelete(RegLoc+"user");
		 WSHShell.RegDelete(RegLoc+"logindate");
		 WSHShell.RegDelete(RegLoc+"logintime");
	}
	
	//Reset Old registry Values 
 	function ClearRegistryfromPage() 
	{
		 WSHShell.RegWrite(RegLoc+"jamroom", "");
		 //WSHShell.RegWrite(RegLoc+"jam", "");
		 WSHShell.RegWrite(RegLoc+"jamroomtype", "");
		 WSHShell.RegWrite(RegLoc+"durationleft", "");
		 WSHShell.RegWrite(RegLoc+"user", "");
		 WSHShell.RegWrite(RegLoc+"logindate", "");
		 WSHShell.RegWrite(RegLoc+"logintime", "");
	 }*/
	
	//Write New registry Values

	function chkLogin(UPassword)
	{
		var Lginpwd;
		while(UPassword!=Lginpwd)
		{
			Lginpwd=prompt('Please enter jam room password.','');
			if(Lginpwd=="" || (UPassword!=Lginpwd && Lginpwd != null) ){continue;}
			return Lginpwd;
		}
	}
function ResetRegistryfromPage(jRoom,User,dLeft,jType) 
{	
	//if(jamstatus=="Available")
	//{
		try
			{	
				WSHShell = new ActiveXObject("WScript.Shell");
			}
		catch(err)
			{
				//alert("Please Enable 'Initialize and Script ActiveX Controls not marked as Safe.' In TOOLS->INTERNET OPTIONS->SECURITY->CUSTOM LEVEL->ACTIVEX CONTROLS AND PLUG-INS.");
				alert("Please 'enable' or set to 'prompt' the 'Initialize and script ActiveX controls not marked as safe for scripting.'  This can be found in Tools -> Security -> Custom Level -> ActiveX Controls and Plug-ins -> Initialize and script ActiveX controls not marked as safe for scripting. You will then be able to access the virtual jam application.");
				//alert(err.discription + "128");
				return;
			}
		  //alert("Password : "+jType);
		//alert("Password : "+UPassword);
		/*if(jType=="Public")
		{*/
			/*if(((jType=="Private") && (UPassword!=chkLogin(UPassword))))
			{
				alert("Please access this room during the indicated session time.");
				return;
			}*/
			/*else if((jType=="Private") || (UPassword==chkLogin(UPassword)))
			{
				alert("Authentication Failed, JAM Access Denied.");
				exit;
				//break;
			}*/
		
			
			user			=User;
				/*if(user=="Public" || user=="" || user==null)
				//alert(User);
				{
					user="";
					//alert(user);
					while(user=="")
					{
						user=prompt('Please enter a user name so others can identify you in the jam room.(This is only required for users who are not logged-in to infusician.com.).','');
						if(user==""){continue;}
					}
					//alert(user);
				//Prompt("You are not Login into this Aplication. So Please Enter your Name.","");}
				}*/
				if(!(user=="" || user==null))
				{
				//alert("USer Not Null");
					//WSHShell = new ActiveXObject("WScript.Shell");
				//Clear Registry from Page;
					WSHShell.RegWrite(RegLoc+"jamroom", "");
					 //WSHShell.RegWrite(RegLoc+"jam", "");
					 WSHShell.RegWrite(RegLoc+"jamroomtype", "");
					 WSHShell.RegWrite(RegLoc+"durationleft", "");
					 WSHShell.RegWrite(RegLoc+"user", "");
					 WSHShell.RegWrite(RegLoc+"logindate", "");
					 WSHShell.RegWrite(RegLoc+"logintime", "");
				//DeleteRegistryfromPage();
					currentDate		=new Date();
			
					xx=new Date()
					dd=xx.getDate()
					if(dd<10){dd="0"+dd;} 
					mm=xx.getMonth()+1
					if(mm<10){mm="0"+mm;}
					yy=xx.getYear()
					mmddyy=mm+"/"+dd+"/"+yy
			
					logindate=dd+"/"+mm+"/"+yy
                   /**/
                    hr=currentDate.getHours();
					mt=currentDate.getMinutes();
					st=currentDate.getSeconds();
					if(hr<10)
					    {
						hr="0"+hr;
						}
					if(mt<10)
					    {
						mt="0"+mt;
						}
                     if(st<10)
					    {
						st="0"+st;
						}
					logintime		=hr+":"+mt+":"+st;
					
					//logintime		=currentDate.getHours()+":"+currentDate.getMinutes()+":"+currentDate.getSeconds();

					currentDate		=currentDate.toLocaleString();
					
					jamroom			=jRoom;
					jamroomtype		=jType;
					durationleft	=dLeft;
					//user="Public";
						//alert(user);
					WSHShell.RegWrite(RegLoc+"jamroom", jamroom);
					//WSHShell.RegWrite(RegLoc+"jam", jam);
					WSHShell.RegWrite(RegLoc+"jamroomtype", jamroomtype);
					WSHShell.RegWrite(RegLoc+"durationleft", durationleft);
					WSHShell.RegWrite(RegLoc+"user", user);
					WSHShell.RegWrite(RegLoc+"logindate", logindate);
					WSHShell.RegWrite(RegLoc+"logintime", logintime);
					ninjamclient();
				}
				  //if(user!="Public"){}
		//}
		/*else if(jamStatus=="Available")
		{
			alert("This Jam is not Available at this Time.");
		}	
		else if(jamStatus=="Closed")
		{
			alert("This Jam has been Closed now.");
		}	*/
}


function ninjamclient()
{
		//for(i=0;i<=10000;i++){}
		var ab=new ActiveXObject("WScript.Shell");
		//try
		//ab.Run("http://www.infusician.com/jam/ninjam.exe");
		try
		{
			ab.Run("http://www.infuscian.com/jam/ninjam.exe");//ab.Run("ninjam.exe");
		}
		catch(errApp)
		{
			ab.Run("http://www.infuscian.com/jam/ninjam.exe");
			//alert(errApp.discription + "229");
		}
}
     /*var oShell = new ActiveXObject("WScript.Shell");
             oShell.Run("d:\\raw\\msibuilder.msi",1);*/


   //--> 
  