﻿//Used for privacy policy popUp
function PrivacyPolicy()
{	
	var url;
	var LeftPosition = (screen.width) ? (screen.width-750)/2 : 0;
	var TopPosition = (screen.height) ? (screen.height-500)/2 : 0;
	var features = 'height='+500+',width='+750+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes'		
	url = '/privacypolicy.aspx';
	window.open(url,'privacyPolicy',features);
}

//Validate Search Box in all Default & Landing pages
function ValidateSbox(srvId,state,cntry)
{
    var errMsg = '';
    var ddlState = document.getElementById(state);
    
    if (srvId != "7") 
        if (ddlState.value == "")
            errMsg += "\n- State";
               
    if (srvId == "6") 
    {
        var ddlCountry = document.getElementById(cntry);
        if (ddlCountry.value == "")
            errMsg += "\n- Country";
    }
    else if (srvId == "7")
    {
        var ddlCountry = document.getElementById(cntry);
        if (ddlCountry.value == "")
            errMsg += "\n- Country";
        if (ddlState.value == "")
            errMsg += "\n- State";
    }
    if(errMsg != '')
    {
        alert('The following fields are required:' + errMsg);
        return false;
    }
    else    
        return true;
}

//Used to do postback for service type dropdown of search box in default and landing pages
function DdlPostBack(ddlSrv)
{
    if  (document.getElementById(ddlSrv).value != "" && document.getElementById(ddlSrv).value != "Moving Companies" && document.getElementById(ddlSrv).value != "Local Removals")
    {
        var redirectUrl = "";
        if (document.getElementById(ddlSrv).value == "Interstate Removals")
            redirectUrl = "http://www.auremovals.com/interstate-removals.html";
        else if (document.getElementById(ddlSrv).value == "International Movers")
            redirectUrl = "http://www.auremovals.com/international-movers.html";
        else if (document.getElementById(ddlSrv).value == "Corporate Relocation")
            redirectUrl = "http://www.auremovals.com/corporate-relocation.html";
        else if (document.getElementById(ddlSrv).value == "Storage")
            redirectUrl = "http://www.auremovals.com/storage.html";            
            
        window.location.href = redirectUrl;
    }
    else if (document.getElementById(ddlSrv).value != "")
    {
        var currentUrl = window.location.pathname;
        if (currentUrl != "/" && currentUrl != "/moving-companies.html" && currentUrl != "/local-removals.html")
        {
            var redirectUrl = "";
            if (document.getElementById(ddlSrv).value == "Moving Companies")
                redirectUrl = "http://www.auremovals.com/moving-companies.html";
            else if (document.getElementById(ddlSrv).value == "Local Removals")
                redirectUrl = "http://www.auremovals.com/local-removals.html";
            window.location.href = redirectUrl;
        }
    }
}

