// hrrareg.js - routines to enable direct registration links from a home page
// centerforrealestate.com, using IMS.
// 07/16/2008

// RegClass creates and executes the href link to register for a class.
function RegClass(RegCode) {
   $regcall ='https://www.internetmemberservices.com/scripts/mgrqispi.dll'
	+ '?APPNAME=IMS' + '&PRGNAME=IMSMemberLoginCookie' + '&ARGUMENTS=-AHRRA'
	+ '&SessionType=N'
	+ '&ServiceName=REGE'
	+ '&ClassID=' + RegCode;
	location.href = $regcall;
}

// RegEvent creates and executes the href link to register for an event.
function RegEvent(RegCode) {
   $regcall ='https://www.internetmemberservices.com/scripts/mgrqispi.dll'
	+ '?APPNAME=IMS' + '&PRGNAME=IMSMemberLoginCookie' + '&ARGUMENTS=-AHRRA'
	+ '&SessionType=M'
	+ '&ServiceName=REGV'
	+ '&EventID=' + RegCode;
	location.href = $regcall;
}

// RegConv creates and executes the href link to register for a convention.
function RegConv(RegCode) {
   $regcall ='https://www.internetmemberservices.com/scripts/mgrqispi.dll'
	+ '?APPNAME=IMS' + '&PRGNAME=IMSMemberLoginCookie' + '&ARGUMENTS=-AHRRA'
	+ '&SessionType=M'
	+ '&ServiceName=REGC'
	+ '&EventID=' + RegCode;
	location.href = $regcall;
}

// ShowFile calls the program that sends the file to the users browser.
function ShowFile(File_Location) {
	if(File_Location.substring(0,6)=="Select") {
		return;
		}

	type	= "<?PHP echo $folder; ?>";
	path	= 'file_loader.php';
	method	= "post";

	var form = document.createElement("form");
	form.setAttribute("method", method);
	form.setAttribute("action", path);

	var hiddenField = document.createElement("input");
        hiddenField.setAttribute("type", "hidden");
        hiddenField.setAttribute("name", "File");
        hiddenField.setAttribute("value", File_Location);
        form.appendChild(hiddenField);

        var hiddenField = document.createElement("input");
        hiddenField.setAttribute("type", "hidden");
        hiddenField.setAttribute("name", "Type");
        hiddenField.setAttribute("value", type);
        form.appendChild(hiddenField);

        document.body.appendChild(form);
        form.submit();
}

// Download Selection from dropdown menu
function Download(dropdown){
	var myindex  = dropdown.selectedIndex
	var SelValue = dropdown.options[myindex].value
	ShowFile(SelValue);
}


