    var selectedTabId       = GetQueryString("tabId");
	var selectedDealerId    = GetQueryString("dealerId");
    var selectedImageId = GetQueryString("detailModelIndex");
    var videoFile = GetQueryString("video");;
    
	function GetUrl(argsUrl, isFlashUrl, tabid, tabdetailindex, video)
	{
	    var url = argsUrl;
    
    	if(selectedTabId != null && selectedTabId!="")
    	{
    	    url += isFlashUrl ? "&&" : "?";
    	    url += "tabId="+selectedTabId;
    	    
    	    if(!isFlashUrl && selectedDealerId != null && selectedDealerId != "")
    	    {
    	        url+="&dealerId="+selectedDealerId;
    	    }
    	  
   	        if(!isFlashUrl && tabdetailindex != null && tabdetailindex != "")
    	    {
    	        url+="&detailModelIndex="+tabdetailindex;
    	    }
    	    
    	    if(!isFlashUrl && video != null && video != "")
    	    {
    	        url+="&video="+video;
    	    }
    	}
        //alert(url);
    	return url;
	}
    
    
	function gotoSmallView(xmlFileString, tabid, tabdetailindex) 
	{
	    //debugger;
		window.location	= GetUrl(modelURL, false, tabid, tabdetailindex, "");
	}
	
	function gotoBigView(xmlFileString, tabid, tabdetailindex) 
	{
	    //debugger;
	    var currentUrl = window.location.href;
	    
	    if(currentUrl.indexOf(".") >-1)
	    {
	        var fullPath = currentUrl.substr(0,currentUrl.lastIndexOf(".aspx"))+"/CarModelZoom.aspx";
	        window.location = GetUrl(fullPath, false, tabid, tabdetailindex, "");
	    }
	}	

	function gotoBigVideoView(xmlUri, tabID, video)
	{
	    var currentUrl = window.location.href;
	    
	    if(currentUrl.indexOf(".") >-1)
	    {
	        var fullPath = currentUrl.substr(0,currentUrl.lastIndexOf(".aspx"))+"/CarModelZoom.aspx";
	        window.location = GetUrl(fullPath, false, tabID, 0, video);
	    }
	}
	
	function gotoSmallVideoView(xmlUri, tabID, video)
	{
		window.location	= GetUrl(modelURL, false, tabID, 0, video);
	}
		
	function backToOverview(xmlFileString, tabid, tabdetailindex) 
	{
	    //debugger;
		window.location	= GetUrl(modelURL, false, tabid, tabdetailindex, "");
	}
	

	function tabClicked(tabId)
	{
	    //alert(tabId);
		selectedTabId = tabId;
	}
	
    function proefritClicked(xmlFileString) 
	{
		window.location = testDriveURL;
	}

    function InsertFlashForCarModel()
    {
        //debugger;
        //var xmlUrl = GetUrl(modelCarouselFlashXML, true);
        //debugger;
        AC_FL_RunContent(
			"src", modelCarouselFlash,
			"width", "100%",
			"height", "100%",
			"align", "middle",
			"id", "TabDetailsBig",
			"quality", "high",
			"bgcolor", "#869ca7",
			"wmode", "transparent",
			"name", "TabDetailsBig",
			"allowScriptAccess","sameDomain",
			"type", "application/x-shockwave-flash",
			"pluginspage", "http://www.adobe.com/go/getflashplayer",
			"flashvars","xmlURL=" + modelCarouselFlashXML + "&&detailModelIndex=" + selectedImageId + "&&tabID=" + selectedTabId + "&video=" + videoFile//GetUrl(modelCarouselFlashXML, true)
	        );
    }