
function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}



function setCheckedValue(radioObj, newValue) {
	if(!radioObj)
		return;
	var radioLength = radioObj.length;
	
	for(var i = 0; i < radioLength; i++) {
		radioObj[i].checked = false;
		if(radioObj[i].value == newValue.toString()) {
			radioObj[i].checked = true;
		}
	}
}


function QueryString(key)
{
	var value = null;
	for (var i=0;i<QueryString.keys.length;i++)
	{
		if (QueryString.keys[i]==key)
		{
			value = QueryString.values[i];
			break;
		}
	}
	return value;
}
QueryString.keys = new Array();
QueryString.values = new Array();

function QueryString_Parse()
{
	var query = window.location.search.substring(1);
	var pairs = query.split("&");
	
	for (var i=0;i<pairs.length;i++)
	{
		var pos = pairs[i].indexOf('=');
		if (pos >= 0)
		{
			var argname = pairs[i].substring(0,pos);
			var value = pairs[i].substring(pos+1);
			QueryString.keys[QueryString.keys.length] = argname;
			QueryString.values[QueryString.values.length] = value;		
		}
	}

}

QueryString_Parse();





 function checkfieldforblanks(buildproductlist) {

	if (buildproductlist.CollectionSearch.value==""){
	alert("Please enter a value.");
	buildproductlist.CollectionSearch.focus();
	return false;
	}

return true;

} 






function ClickRegister()
{ if (document.QUOTE.eMail.value == '') {alert('You must complete your email address before you Register')} 
   else
    {var userId = '&Browser=' + QueryString('aa');
     var date = new Date();
     var d  = date.getDate();
     var day = (d < 10) ? '0' + d : d;
     var m = date.getMonth() + 1;
     var month = (m < 10) ? '0' + m : m;
     var yy = date.getYear();
     var year = (yy < 1000) ? yy + 1900 : yy;
     var dateClicked = '&Date=' + (day + "/" + month + "/" + year);
     var email = document.QUOTE.eMail.value;
     var message = userId + dateClicked + '&Email=' + email;
     var objHTTP = new ActiveXObject("Microsoft.XMLHTTP");
     objHTTP.Open('GET','/Perspective/httplisten.php?command=MSCNEWSLETTER' + message,false);
     objHTTP.Send();
     alert('Thank you - we will add your eMail address to our mailing list');
    }
  return;
}


function ClickRegisterQuickInfo()
{if (document.QUOTE.eMail.value == '') {alert('You must complete your email address before you Register')} 
   else
    {var userId = '&Browser=' + QueryString('aa');
     var date = new Date();
     var d  = date.getDate();
     var day = (d < 10) ? '0' + d : d;
     var m = date.getMonth() + 1;
     var month = (m < 10) ? '0' + m : m;
     var yy = date.getYear();
     var year = (yy < 1000) ? yy + 1900 : yy;
     var dateClicked = '&Date=' + (day + "/" + month + "/" + year);
     var email = document.QUOTE.eMail.value;	
     var Product = document.QUOTE.Product.value;
     var message = userId + dateClicked + '&Email=' + email + '&Product=' + Product;
     var objHTTP = new ActiveXObject("Microsoft.XMLHTTP");
     objHTTP.Open('GET','http://www.medical-supply.ie/Perspective/httplisten.php?command=MSCQUICKINFO' + message,false);
     objHTTP.Send();
     alert('Thank you - we will contact you with respect to this product shortly');
    }
  return
}

function ClickContactEnquiry()
{ if (document.QUOTE.eMail.value == '' && document.QUOTE.Phone.value == ''&& document.QUOTE.Mobile.value == '') 
    {alert('You must provide an email address, a phone number or a mobile number to allow us respond to your query')} 
   else
    {var userId = '&Browser=' + QueryString('aa');
     var date = new Date();
     var d  = date.getDate();
     var day = (d < 10) ? '0' + d : d;
     var m = date.getMonth() + 1;
     var month = (m < 10) ? '0' + m : m;
     var yy = date.getYear();
     var year = (yy < 1000) ? yy + 1900 : yy;
     var dateClicked = '&Date=' + (day + "/" + month + "/" + year);
     var email = document.QUOTE.eMail.value;
     var phone = document.QUOTE.Phone.value;
     var Mobile = document.QUOTE.Mobile.value;
     var Question = document.QUOTE.Question.value;
     var Name = document.QUOTE.Name.value;	
     var Institute = document.QUOTE.Institute.value;
     var message = userId + dateClicked + '&Email=' + email + '&Phone=' + phone + '&Mobile=' + Mobile + '&Question=' + Question + '&Name=' + Name + '&Institute=' + Institute;
     var objHTTP = new ActiveXObject("Microsoft.XMLHTTP");
     objHTTP.Open('GET','/Perspective/httplisten.php?command=MSCENQUIRY' + message,false);
     objHTTP.Send();
     alert('Thank you - we will contact you shortly to deal with your query');
    }
}

function ClickRegisterEvent()
{if (document.QUOTE.eMail.value == '' && document.QUOTE.Phone.value == '' && document.QUOTE.Mobile.value == '') 
    {alert('You must provide an email address, a phone number or a mobile number to allow us respond to your query')} 
   else if (document.QUOTE.Event.value == '') {alert('You must identify which event you wish to attend');}
   else
    {var userId = '&Browser=' + QueryString('aa');
     var date = new Date();
     var d  = date.getDate();
     var day = (d < 10) ? '0' + d : d;
     var m = date.getMonth() + 1;
     var month = (m < 10) ? '0' + m : m;
     var yy = date.getYear();
     var year = (yy < 1000) ? yy + 1900 : yy;
     var dateClicked = '&Date=' + (day + "/" + month + "/" + year);
     var Name = document.QUOTE.Name.value;
     var Institute = document.QUOTE.Institute.value;
     var eMail= document.QUOTE.eMail.value;
     var Phone = document.QUOTE.Phone.value;
     var Mobile = document.QUOTE.Mobile.value;	
     var Event = document.QUOTE.Event.value;
     var Comments = document.QUOTE.Comments.value;
     var message = userId + dateClicked + '&Name=' + Name + '&Institute=' + Institute + '&eMail=' + eMail + '&Phone=' + Phone + '&Mobile=' + Mobile + '&Event=' + Event + '&Comments=' + Comments;
     var objHTTP = new ActiveXObject("Microsoft.XMLHTTP");
     objHTTP.Open('GET','/Perspective/httplisten.php?command=MSCEVENTREG' + message,false);
     objHTTP.Send();
     alert('Thank you - we will contact you shortly with regard to this event');
    }
}
 function ClickRegisterSample()
{if (document.QUOTE.eMail.value == '' && document.QUOTE.Phone.value == '' && document.QUOTE.Mobile.value == '') 
    {alert('You must provide an email address, a phone number or a mobile number to allow us respond to your query')} 
   else
    {var userId = '&Browser=' + QueryString('aa');
     var date = new Date();
     var d  = date.getDate();
     var day = (d < 10) ? '0' + d : d;
     var m = date.getMonth() + 1;
     var month = (m < 10) ? '0' + m : m;
     var yy = date.getYear();
     var year = (yy < 1000) ? yy + 1900 : yy;
     var dateClicked = '&Date=' + (day + "/" + month + "/" + year);
     var Name = document.QUOTE.Name.value;
     var Institute = document.QUOTE.Institute.value;
     var eMail= document.QUOTE.eMail.value;
     var Phone = document.QUOTE.Phone.value;
     var Mobile = document.QUOTE.Mobile.value;	
     var Event = document.QUOTE.Sample.options[document.QUOTE.Sample.selectedIndex].value
     var Comments = document.QUOTE.Comments.value;
     var message = userId + dateClicked + '&Name=' + Name + '&Institute=' + Institute + '&eMail=' + eMail + '&Phone=' + Phone + '&Mobile=' + Mobile + '&Event=' + Event + '&Comments=' + Comments;
     var objHTTP = new ActiveXObject("Microsoft.XMLHTTP");
     objHTTP.Open('GET','/Perspective/httplisten.php?command=MSCEVENTREG' + message,false);
     objHTTP.Send();
     alert('Thank you - we will contact you shortly with regard to this sample');
    }
}


function ClickRegisterShopping()
{

  // Enter name of mandatory fields
  var fieldRequired = Array("Company", "Department", "Name", "eMail", "Phone");
  var fieldList = Array("Company", "Department", "Name", "Title", "eMail", "Phone", "Mobile", "Comments");

  // Enter field description to appear in the dialog box
  var fieldDescription = Array("Company/Institute Name", "Department", "E-Mail", "Your Name", "Phone Number");
  
  // Variable for account number and address validation
  //var hasAccount = true;
  //var hasAddress = true;
  

  // dialog message creation forms[0] is the register form on the register.htm page needs to be identified in this manner to work in Netscape and Mozilla
  var alertMsg = "Please complete the following for registration.\n";
  var l_Msg = alertMsg.length;

  for (var i = 0; i < fieldRequired.length; i++)
  {
    var obj = document.forms[0].elements[fieldRequired[i]];
    if (obj.value == "" || obj.value == null)
    {
      // Check mandatory fields
      if (i <= 6)
      {  
        alertMsg += " - " + fieldDescription[i] + "\n";
      }
 
    }  
  }

if (document.forms[0].eMail.value.indexOf("@") == -1 || document.forms[0].eMail.value.indexOf(".") == -1) {
alertMsg += " ------------- \n" + "Please include a valid email address.";
}


  if (alertMsg.length == l_Msg)
  {
	
     var Name = '&Name=' + document.forms[0].Name.value;
     var Title = '&Title=' +document.forms[0].Title.value;
     var eMail = '&eMail=' + document.forms[0].eMail.value;
     var Company = '&Company=' + document.forms[0].Company.value;
     var Department = '&Department=' + document.forms[0].Department.value;
     var Phone = '&Phone=' + document.forms[0].Phone.value;
     var Mobile = '&Mobile=' + document.forms[0].Mobile.value;
     var Comments = '&Comments=' + document.forms[0].Comments.value;
    

     var date = new Date();
     var d  = date.getDate();
     var day = (d < 10) ? '0' + d : d;
     var m = date.getMonth() + 1;
     var month = (m < 10) ? '0' + m : m;
     var yy = date.getYear();
     var year = (yy < 1000) ? yy + 1900 : yy;
     var dateClicked = '&Date=' + (day + "/" + month + "/" + year);

     var message = 'http://www.medical-supply.ie/perspective/httplisten.php?command=MSCREGISTER' + dateClicked + '&Company=' + Company + '&Department=' + Department + '&Name=' + Name + '&Title=' + Title + '&eMail=' + eMail + '&Mobile=' + Mobile + '&Phone=' + Phone + '&Comments=' + Comments;

//Call loadXMLDoc function     
loadXMLDoc(message)
	
//Tidy up and clear fields
    for (var x = 0; x < fieldList.length; x++)
    {
      var obj2 = document.forms[0].elements[fieldList[x]];
      obj2.value = "";

    }

  

  }
  else
  {
    alert(alertMsg);
    //return false;
  }
}
 


function pex_application_validate()
{

  // Enter name of mandatory fields
  var fieldRequired = Array("FName", "LName", "Inst", "Dept", "Street", "Town", "County", "Phone", "eMail");
  var fieldList =  Array("WhatProducts", "NoofUsers", "Departments", "locateunit", "group2", "Other", "FName", "Checkbox1", "LName", "Inst", "Dept", "Street", "Room", "Town", "County", "Phone", "Fax", "eMail", "PrevInst");
  

  // Enter field description to appear in the dialog box
  var fieldDescription = Array("First Name", "Last Name", "Institute Name", "Department","Street Address", "Town", "County", "Phone Number", "E-Mail");
   
  // Variable for account number and address validation
  //var hasAccount = true;
  //var hasAddress = true;
  

  // dialog message creation forms[0] is the register form on the register.htm page needs to be identified in this manner to work in Netscape and Mozilla
  var alertMsg = "Please complete the following for registration.\n";
  var l_Msg = alertMsg.length;

  for (var i = 0; i < fieldRequired.length; i++)
  {
    var obj = document.forms[0].elements[fieldRequired[i]];
    if (obj.value == "" || obj.value == null)
   
    {
      // Check mandatory fields
      if (i <= 6)
      {  
        alertMsg += " - " + fieldDescription[i] + "\n";
        
      }
 
    }  
  }

if (document.forms[0].eMail.value.indexOf("@") == -1 || document.forms[0].eMail.value.indexOf(".") == -1) {
alertMsg += " ------------- \n" + "Please include a valid email address.";
}


  if (alertMsg.length == l_Msg)
  {
    
     var WhatProducts = document.forms[0].WhatProducts.value;
     var NoofUsers = document.forms[0].NoofUsers.value;
     var Departments = document.forms[0].Departments.value;
     var locateunit = document.forms[0].locateunit.value;
     var group2 = getCheckedValue(document.forms[0].elements['group2']);
     var Other = document.forms[0].Other.value;
     var FName = document.forms[0].FName.value;
     var Checkbox1 = document.forms[0].Checkbox1.checked;
     var LName = document.forms[0].LName.value;
     var Inst = document.forms[0].Inst.value;
     var Dept = document.forms[0].Dept.value;
     var Street = document.forms[0].Street.value;
     var Room = document.forms[0].Room.value;
     var Town = document.forms[0].Town.value;
     var County = document.forms[0].County.value;
     var Phone = document.forms[0].Phone.value;
     var Fax = document.forms[0].Fax.value;
     var eMail = document.forms[0].eMail.value;
     var PrevInst = document.forms[0].PrevInst.value;

     var date = new Date();
     var d  = date.getDate();
     var day = (d < 10) ? '0' + d : d;
     var m = date.getMonth() + 1;
     var month = (m < 10) ? '0' + m : m;
     var yy = date.getYear();
     var year = (yy < 1000) ? yy + 1900 : yy;
     var dateClicked = (day + "/" + month + "/" + year);

 
     //var message = 'http://www.medical-supply.ie/perspective/httplisten.php?command=zme-postmessage&xContent=Dash&xCategory=pex_application&xMessage=' + dateClicked +  WhatProducts +  NoofUsers + Departments + locateunit  + group2 +  Other +  FName + Checkbox1 +  LName + Inst + Dept +  Street + Room + Town +  County +  Phone + Fax +  eMail +  PrevInst;


var message = 'http://www.medical-supply.ie/perspective/httplisten.php?command=zme-postmessage&xContext=Dash&xCategory=pex_application&xMessage=MSC:'+dateClicked+',pex_application Registration<BR><table><tr><td>WhatProducts: '+WhatProducts+'</td></tr><tr><td>NoofUsers: '+NoofUsers+'</td></tr><tr><td>Departments: '+Departments+'</td></tr><tr><td>locateunit: '+locateunit+'</td></tr></table><P>Position:'+ group2 + Other +'</P><table><tr><td>First Name:'+FName+'</td><td>Last Name:'+LName+'</td><td>Institute:'+Inst+'</td></tr><tr><td>Department:'+Dept+'</td><td>Street:'+Street+'</td><td>Room:'+Room+'</td></tr><tr><td>Town:'+Town+'</td><td>County:'+County+'</td><td>Phone:'+Phone+'</td></tr><tr><td>Fax:'+Fax+'</td><td>eMail:'+eMail+'</td><td>Previous Institute:'+PrevInst+'</td></tr></table><p>Mailing list:'+Checkbox1+'</P>';
	
	//alert(message)
//Call loadXMLDoc function     
loadXMLDoc(message)
	
//Tidy up and clear fields
    setCheckedValue(document.forms[0].elements['group2'], '');
    document.forms[0].Checkbox1.checked=false;
    for (var x = 0; x < fieldList.length; x++)
    {
      var obj2 = document.forms[0].elements[fieldList[x]];
      obj2.value = "";

    }



  

  }
  else
  {
    alert(alertMsg);
    //return false;
  }
}


 

function gg_register()
{

  // Enter name of mandatory fields
  var fieldRequired = Array("FName", "LName", "Inst", "Dept", "Street", "Town", "County", "Phone", "eMail");
 var fieldList =  Array("Checkbox2", "group2", "Other", "FName", "Checkbox1", "LName", "Inst", "Dept", "Street", "Room", "Town", "County", "Phone", "Fax", "eMail", "PrevInst");
  

  // Enter field description to appear in the dialog box
  var fieldDescription = Array("First Name", "Last Name", "Institute Name", "Department","Street Address", "Town", "County", "Phone Number", "E-Mail");
   
  // Variable for account number and address validation
  //var hasAccount = true;
  //var hasAddress = true;
  

  // dialog message creation forms[0] is the register form on the register.htm page needs to be identified in this manner to work in Netscape and Mozilla
  var alertMsg = "Please complete the following for registration.\n";
  var l_Msg = alertMsg.length;

  for (var i = 0; i < fieldRequired.length; i++)
  {
    var obj = document.forms[0].elements[fieldRequired[i]];
    if (obj.value == "" || obj.value == null)
    {
      // Check mandatory fields
      if (i <= 6)
      {  
        alertMsg += " - " + fieldDescription[i] + "\n";
      }
 
    }  
  }

if (document.forms[0].eMail.value.indexOf("@") == -1 || document.forms[0].eMail.value.indexOf(".") == -1) {
alertMsg += " ------------- \n" + "Please include a valid email address.";
}


  if (alertMsg.length == l_Msg)
  {

     var Checkbox2 = document.forms[0].Checkbox2.checked;
     var group2 = getCheckedValue(document.forms[0].elements['group2']);
     var Other = document.forms[0].Other.value;
     var FName = document.forms[0].FName.value;
     var Checkbox1 = document.forms[0].Checkbox1.checked;
     var LName = document.forms[0].LName.value;
     var Inst = document.forms[0].Inst.value;
     var Dept = document.forms[0].Dept.value;
     var Street = document.forms[0].Street.value;
     var Room = document.forms[0].Room.value;
     var Town = document.forms[0].Town.value;
     var County = document.forms[0].County.value;
     var Phone = document.forms[0].Phone.value;
     var Fax = document.forms[0].Fax.value;
     var eMail = document.forms[0].eMail.value;
     var PrevInst = document.forms[0].PrevInst.value;

     var date = new Date();
     var d  = date.getDate();
     var day = (d < 10) ? '0' + d : d;
     var m = date.getMonth() + 1;
     var month = (m < 10) ? '0' + m : m;
     var yy = date.getYear();
     var year = (yy < 1000) ? yy + 1900 : yy;
     var dateClicked = (day + "/" + month + "/" + year);

    var message = 'http://www.medical-supply.ie/perspective/httplisten.php?command=zme-postmessage&xContext=Dash&xCategory=gg_register&xMessage=MSC:'+dateClicked+',gifts galore Registration<BR><p>Please send me a collection form:'+Checkbox2+'</P><P>Position:'+ group2 + Other +'</P><table><tr><td>First Name:'+FName+'</td><td>Last Name:'+LName+'</td><td>Institute:'+Inst+'</td></tr><tr><td>Department:'+Dept+'</td><td>Street:'+Street+'</td><td>Room:'+Room+'</td></tr><tr><td>Town:'+Town+'</td><td>County:'+County+'</td><td>Phone:'+Phone+'</td></tr><tr><td>Fax:'+Fax+'</td><td>eMail:'+eMail+'</td><td>Previous Institute:'+PrevInst+'</td></tr></table><p>Mailing list:'+Checkbox1+'</P>';
	

//alert(message)
//Call loadXMLDoc function     
loadXMLDoc(message)
	
//Tidy up and clear fields

  setCheckedValue(document.forms[0].elements['group2'], '');
   
    document.forms[0].Checkbox1.checked=false;
    document.forms[0].Checkbox2.checked=false;
    for (var x = 0; x < fieldList.length; x++)
    {
      var obj2 = document.forms[0].elements[fieldList[x]];
      obj2.value = "";

    }



  }
  else
  {
    alert(alertMsg);
    //return false;
  }
}
 




var xmlhttp
function loadXMLDoc(url)
{
// code for Mozilla, etc.
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest()
  xmlhttp.onreadystatechange=xmlhttpChange
  xmlhttp.open("GET",url,true)
  xmlhttp.send(null)
  alert("Thank you - we will contact you shortly with regard to this registration.");
  }
// code for IE
else if (window.ActiveXObject)
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
    if (xmlhttp)
    {
    xmlhttp.onreadystatechange=xmlhttpChange
    xmlhttp.open("GET",url,true)
    xmlhttp.send()
alert("Thank you - we will contact you shortly with regard to this registration.");
    }
  }
}

//Error handling

function xmlhttpChange()
{
// if xmlhttp shows "loaded"
if (xmlhttp.readyState==4)
  {
  // if "OK"
  if (xmlhttp.status==200)
    {
    // ...some code here
	
    }
  else
    {
    alert("Problem retrieving XML data")
    }
  }
}



 
