﻿    function checkTheDomain()
    {
        var hostName = location.hostname.toLowerCase();        
       
        if (hostName.indexOf("www")!=0)
        {
            var pro = location.protocol;
            
            if (pro=="http:" || pro=="https:")
            {
                var portValue = location.port;
                var urlTarget = pro + "//www." + hostName + portValue;

                alert(urlTarget);
                location.href = urlTarget;
            }
            else
            {
                alert(pro);
            }
            
            return;
        }    	
    }
    