var Mods="&hidEngine=false&hidVehicle=false&hidSearch=false&hidBrand=false"
var cUrl="http://teamcperformance.estore.catalograck.com"
setDciSearch();
setDciVehicleModule();
setDciEngineModule();
setDciBrandModule();
checkDciSearch();


function setDciSearch() 
{
	if (window.location.href.indexOf("?") > 0)
	{	
	
		var qs = window.location.href.substring(window.location.href.indexOf("?"),window.location.href.length);		
		var ifDciSearch = document.getElementById("ifDciSearch");		
		if (ifDciSearch != null)
		{
		    if (qs.indexOf("hdnUK") > 0)
		    {		      
		        ifDciSearch.src = cUrl + "/v5/Members/lookups/Default.asp" + qs + Mods;
		    }
		    else
		    {		     
				ifDciSearch.src = cUrl + "/default.asp" + qs + Mods;
		    }			
		}
	}
	else
	{				  
		var ifDciSearch = document.getElementById("ifDciSearch");	
		if (ifDciSearch != null)	
			ifDciSearch.src = cUrl + "/default.asp?XYZ=" + Mods;		
	}
}



function setDciVehicleModule() 
{		

	if (window.location.href.indexOf("?") > 0)
	{		
		var qs = window.location.href.substring(window.location.href.indexOf("?"),window.location.href.length);		
		var ifVehicleModule = document.getElementById("ifVehicleModule");
		if (ifVehicleModule != null)
		{		  
		    if (qs.indexOf("hdnUK") > 0)
		    {
		        ifVehicleModule.src = cUrl + "/v5/Modules/VehicleModule.asp" + qs + Mods;
		    }
		    else
		    {		     
		        ifVehicleModule.src = cUrl + "/v5/Modules/Default.asp?Module=Vehicle" + Mods;
		    }	
		}		
	}
	else
	{			
		var ifVehicleModule = document.getElementById("ifVehicleModule");
		if (ifVehicleModule != null)
			ifVehicleModule.src = cUrl + "/v5/Modules/Default.asp?Module=Vehicle" + Mods;		
	}
}


function setDciEngineModule() 
{	  
	if (window.location.href.indexOf("?") > 0)
	{					
		var qs = window.location.href.substring(window.location.href.indexOf("?"),window.location.href.length);
		var ifEngineModule = document.getElementById("ifEngineModule");
		if (ifEngineModule != null)
		{
		    if (qs.indexOf("hdnUK") > 0)
		    {
			    ifEngineModule.src = cUrl + "/v5/Modules/EngineModule.asp" + qs + Mods;
			}
			else
			{
				ifEngineModule.src = cUrl + "/v5/Modules/Default.asp?Module=Engine" + Mods;
			}
		}
	}
	else
	{			
		var ifEngineModule = document.getElementById("ifEngineModule");
		if (ifEngineModule != null)
			ifEngineModule.src = cUrl + "/v5/Modules/Default.asp?Module=Engine" + Mods;
	}
}


function setDciBrandModule() 
{	  
	if (window.location.href.indexOf("?") > 0)
	{					
		var qs = window.location.href.substring(window.location.href.indexOf("?"),window.location.href.indexOf("hdnQ")-1);		
		var ifBrandModule = document.getElementById("ifBrandModule");
		if (ifBrandModule != null)	
		{	 			
		    if (qs.indexOf("hdnUK") > 0)
		    {
		        ifBrandModule.src = cUrl + "/v5/Modules/BrandModule.asp" + qs + Mods;
		    }
		    else
		    {
		        ifBrandModule.src = cUrl + "/v5/Modules/Default.asp?Module=Brand" + Mods;
		    }
		}
	}
	else
	{			
		var ifBrandModule = document.getElementById("ifBrandModule");
		if (ifBrandModule != null)
			ifBrandModule.src = cUrl + "/v5/Modules/Default.asp?Module=Brand" + Mods;
	}
}
	
	
function checkDciSearch() 
{    

    var searchParm = "q";
    var strString = window.parent.location.href.split("?");	    
    if (strString.length > 1)
    {		
		var strQuery = strString[1];	
		var strParms = strQuery.split("&")	  
		var strParmsData = "";
		    
		var j = 0;
		for(j = 0; j < strParms.length; j++)
		{		
			strParmsData = strParms[j].split("=")
			if (strParmsData[0] == searchParm)
			{	        
				window.parent.location = "http://teamc.com/lookup.html?XYZ=" + Mods + "&tSearch=" + strParmsData[1];	
			}		
	    }
	}    
}


function externalDciSearch(objSearch) 
{
    var txtSearch = document.getElementById(objSearch);    
	window.parent.location.href = "http://teamc.com/lookup.html?XYZ=" + Mods + "&tSearch=" + txtSearch.value;
}
	
	
