// run through all the links, looking for ones with a class
// of thickbox.  If found, transform the href by appending
// a query string: ?contentOnly=true
// $cmignore
$(document).ready(function() {


	//First, determine whether we are creating a new query string or appending to one.

	
    $("a.thickbox[href*='?']").attr("href", function() {
        return $(this).attr("href") + "&";
    });
	
	
    $("a.thickbox[href!='?']").attr("href", function() {
        return $(this).attr("href") + "?";
    });
	
	/*
	//Check for HGTV Quiz (Special Case)
	$("a.hgtvQuiz").attr("href", function() {
        if ($(this).hasClass("thickbox")) {
            return $(this).attr("href") + "keepThis=true&TB_iframe=true&width=300&height=620";            
        }
    });	
	
	*/
	
	//Now determine whether the video should display as large or small.
	
    $("a.video").attr("href", function() {
        if ($(this).hasClass("thickbox")) {
            return $(this).attr("href") + "contentOnly=true&video=true&width=350&height=300";            
        }
    });
    
    $("a.videoLarge").attr("href", function() {
        if ($(this).hasClass("thickbox")) {
            return $(this).attr("href") + "contentOnly=true&video=true&width=590&height=422";            
        }
    });    

    $("a.videoXLarge").attr("href", function() {
        if ($(this).hasClass("thickbox")) {
            return $(this).attr("href") + "contentOnly=true&video=true&width=700&height=445";            
        }
    });
    
    // Since Collage cannot assign classes to links, let's add the
    // class to all links that have an img with src pointing at
    // view video
    $("a > img[src$='products/logos/video-icon.gif']").parent("a").addClass("thickbox").attr("href", function() {
        return $(this).attr("href") + "?contentOnly=true&video=true&KeepThis=true&TB_iframe=true&width=350&height=300";
    });
});
// $/cmignore

