﻿// -------------------------------------------------------------------------------------------------
// Name          :	PopUpContactUs
// Author        :	COConnor (SDM)
// Creation      :	27 July 2007
// Description   :	Display popup dialog - for CONTACT US
// Parameters	 :	
//
// Modification History:
// -------------------------------------------------------------------------------------------------
//	Version		Date		    Name			    Modification
// -------------------------------------------------------------------------------------------------
//	1.0			27 July 2007	COConnor (SDM)	    Initial Version
// -------------------------------------------------------------------------------------------------
function PopUpContactUs(vAchieveForm, vFormId, vQueryTypeField)
{
	var x, y;
	
	if (self.screenX)
    {
        x = self.screenX + 50;
        y = self.screenY + 50;
    }
    else
    {
        x = window.screenLeft + 50;
        y = window.screenTop + 50;
    }
    
    var queryType = document[vFormId][vQueryTypeField].options[document[vFormId][vQueryTypeField].selectedIndex].value;
    
    var mywindow = window.open(vAchieveForm + '&QueryType=' + queryType,
                                mywindow,
                                'location=0,status=0,menubar=0,resizable=0,scrollbars=1,toolbar=0,width=769,height=600,top=' + y +',left=' + x);
                                
    return false;
}

// -------------------------------------------------------------------------------------------------
// Name          :	PopUpClientInterview
// Author        :	COConnor (SDM)
// Creation      :	30 July 2007
// Description   :	Display popup dialog - for Client Interview
// Parameters	 :	
//
// Modification History:
// -------------------------------------------------------------------------------------------------
//	Version		Date		    Name			    Modification
// -------------------------------------------------------------------------------------------------
//	1.0			27 July 2007	COConnor (SDM)	    Initial Version
// -------------------------------------------------------------------------------------------------
function PopUpClientInterview(vAchieveForm, vFormId, vClientIdField)
{
	var x, y;
	
	if (self.screenX)
    {
        x = self.screenX + 50;
        y = self.screenY + 50;
    }
    else
    {
        x = window.screenLeft + 50;
        y = window.screenTop + 50;
    }
    
    var clientId = document[vFormId][vClientIdField].options[document[vFormId][vClientIdField].selectedIndex].value;
    
    //set to <New Client> then pass to AchieveForm as BLANK
    if (clientId=='-1') clientId='';
    
    var mywindow = window.open(vAchieveForm + '&PreviousClientID=' + clientId,
                                mywindow,
                                'location=0,status=0,menubar=0,resizable=1,scrollbars=1,toolbar=0,width=800,height=780,top=' + y +',left=' + x);
                                
    return false;
}

// -------------------------------------------------------------------------------------------------
// Name          :	PopUpStartNow
// Author        :	COConnor (SDM)
// Creation      :	30 July 2007
// Description   :	Display popup dialog - for Start Now
// Parameters	 :	
//
// Modification History:
// -------------------------------------------------------------------------------------------------
//	Version		Date		    Name			    Modification
// -------------------------------------------------------------------------------------------------
//	1.0			27 July 2007	COConnor (SDM)	    Initial Version
// -------------------------------------------------------------------------------------------------
function PopUpStartNow(vAchieveForm, vFormId, vMatterTypeField)
{
	var x, y;
	
	if (self.screenX)
    {
        x = self.screenX + 50;
        y = self.screenY + 50;
    }
    else
    {
        x = window.screenLeft + 50;
        y = window.screenTop + 50;
    }
    
    var matterType = document[vFormId][vMatterTypeField].options[document[vFormId][vMatterTypeField].selectedIndex].value;
    
    var mywindow = window.open(vAchieveForm + '&MatterType=' + matterType,
                                mywindow,
                                'location=0,status=0,menubar=0,resizable=0,scrollbars=1,toolbar=0,width=769,height=600,top=' + y +',left=' + x);
                                
    return false;
}

// -------------------------------------------------------------------------------------------------
// Name          :	PopUpRegister
// Author        :	COConnor (SDM)
// Creation      :	30 July 2007
// Description   :	Display popup dialog - for Register Now
// Parameters	 :	
//
// Modification History:
// -------------------------------------------------------------------------------------------------
//	Version		Date		    Name			    Modification
// -------------------------------------------------------------------------------------------------
//	1.0			27 July 2007	COConnor (SDM)	    Initial Version
// -------------------------------------------------------------------------------------------------
function PopUpRegister(vAchieveForm, vFormId, vPartnerRoleField)
{
	var x, y;
	
	if (self.screenX)
    {
        x = self.screenX + 50;
        y = self.screenY + 50;
    }
    else
    {
        x = window.screenLeft + 50;
        y = window.screenTop + 50;
    }
    
    var partnerRole = document[vFormId][vPartnerRoleField].options[document[vFormId][vPartnerRoleField].selectedIndex].value;
    
    var mywindow = window.open(vAchieveForm + '&RoleID=' + partnerRole,
                                mywindow,
                                'location=0,status=0,menubar=0,resizable=1,scrollbars=1,toolbar=0,width=769,height=600,top=' + y +',left=' + x);
                                
    
    return false;
}

// -------------------------------------------------------------------------------------------------
// Name          :	PopUpQuote
// Author        :	COConnor (SDM)
// Creation      :	27 July 2007
// Description   :	Display popup dialog - for QUOTE
// Parameters	 :	
//
// Modification History:
// -------------------------------------------------------------------------------------------------
//	Version		Date		    Name			    Modification
// -------------------------------------------------------------------------------------------------
//	1.0			27 July 2007	COConnor (SDM)	    Initial Version
// -------------------------------------------------------------------------------------------------
function PopUpQuote(vAchieveForm, vFormId, vMatterTypeField, vPostCodeField, vPropertyPriceField, vPropertyTypeField, vDiscountTypeField)
{
	var x, y;
	
	if (self.screenX)
    {
        x = self.screenX + 50;
        y = self.screenY + 50;
    }
    else
    {
        x = window.screenLeft + 50;
        y = window.screenTop + 50;
    }

    var matterType = document[vFormId][vMatterTypeField].options[document[vFormId][vMatterTypeField].selectedIndex].value;
    var postCode = document[vFormId][vPostCodeField].value;
    var propertyPrice = document[vFormId][vPropertyPriceField].options[document[vFormId][vPropertyPriceField].selectedIndex].value;
    var propertyType = document[vFormId][vPropertyTypeField].options[document[vFormId][vPropertyTypeField].selectedIndex].value;
    var discountType = document[vFormId][vDiscountTypeField].options[document[vFormId][vDiscountTypeField].selectedIndex].value;
        
    var mywindow = window.open(vAchieveForm + '&MatterTypeID=' + matterType
                                            + '&PropertyPostcode=' + postCode
                                            + '&PropertyPrice=' + propertyPrice
                                            + '&PropertyTypeID=' + propertyType
                                            + '&DiscountTypeID=' + discountType,
                                mywindow,
                                'location=0,status=0,menubar=0,resizable=0,scrollbars=1,toolbar=0,width=400,height=600,top=' + y +',left=' + x);

    return false;
}

function findCompoundField(label, position)
{

	var all_labels = document.getElementsByTagName("LABEL");

	for (var i=0;i<all_labels.length;i++)
	{
		if (all_labels[i].innerHTML == label.toString() + position.toString())
			if (all_labels[i].className == "hiddenlabel")
				return getel(all_labels[i].htmlFor);
	}

	return null;
}

function copyToField (input, output)
{
	//alert('Copying value from field ' + input.id + ' to field ' + output.id);
	input.onkeyup = input.onchange = function () {output.value = this.value;};
}