jQuery(document).ready(function(){
	jQuery('UL.cqlp_tabs LI A').click(function(e){
		thisLink = jQuery(this).attr('href');
		thisClass = jQuery(this).attr('class');
		if(thisClass != 'on'){
			siblings = jQuery(this).parents('UL').eq(0).find('LI A');
			for(index = 0;index < siblings.length; index++){
				thisItem = jQuery(siblings).eq(index);
				changeFlag = false;
				nLink = jQuery(thisItem).attr('href');
				nClass = jQuery(thisItem).attr('class');

				if(nClass = 'on'){
					jQuery(thisItem).removeClass('on');
				}
				
				if(thisLink == nLink){
					jQuery(thisItem).addClass('on');
					jQuery(nLink).show();
				}else{ 
					jQuery(nLink).hide();
				}

			}
		}
		e.preventDefault();
	});

	// apply IE6 transparent PNG fix
	//jQuery('#MastHead,#FooterContent').pngFix(); 

    var flashvars = {};
    flashvars.printerstype = "durabrite";
    var params = { printerstype: "durabrite" };
    var attributes = { printerstype: "durabrite", wmode:"transparent", AllowScriptAccess: "always" };	
	swfobject.embedSWF("http://assets.epson-europe.com/it/colour-quest/images/carousel_it.swf", "durabrite", "366", "268", "9.0.0", flashvars, params, attributes);
  
    flashvars.printerstype = "claria";
    params = { printerstype: "claria" };
	attributes = { printerstype: "claria", wmode:"transparent", AllowScriptAccess: "always" };
	swfobject.embedSWF("http://assets.epson-europe.com/it/colour-quest/images/carousel_it.swf", "claria", "366", "268", "9.0.0", flashvars, params, attributes);
  
    swfobject.embedSWF("http://assets.epson-europe.com/it/colour-quest/images/colourquest.swf", "colourQuest", "780", "320", "9.0.0", "", "", {wmode:"transparent"});

	//modal stuff to go here
	var pageURL = document.URL;
    if (pageURL.indexOf("?submitted=true") > -1) {
	  Epson.UI.Popup.open('Thank you');
	  Epson.UI.Popup.populate('<p>Thank you for signing up to the Epson newsletter.<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /></p>');
	}

});
