
    if(location.protocol.toLowerCase() =='http:' )  
	{

		var newlocation ;

		newlocation = location.href ;

		if (newlocation.toLowerCase().indexOf('http://www2.') > -1 || 
		    newlocation.toLowerCase().indexOf('http://stats2.') > -1 || 
                    newlocation.toLowerCase().indexOf('http://trans2.') > -1)
			{  
				newlocation = newlocation.replace('www2.','');
				newlocation = newlocation.replace('stats2.','');
				newlocation = newlocation.replace('trans2.','');
		                location.href = newlocation.replace('http://','https://stats2.');
			}
		else
		{

			if (newlocation.toLowerCase().indexOf('www.') > -1 )  
				newlocation = newlocation.replace('www.','')

			if (newlocation.toLowerCase().indexOf('stats.') > -1 )  
				newlocation = newlocation.replace('stats.','')

			if (newlocation.toLowerCase().indexOf('trans.') > -1 )  
				newlocation = newlocation.replace('trans.','')

	                location.href = newlocation.replace('http://','https://stats.');
		}
	}



