/*author: dnaspider@gmail.com*/

jQuery("body").hide().fadeIn(); //page


//header loop
function fadeout(){jQuery('div#ho').css("display","none").html("");} //clear last slide
stat=1; //var for header; init
bstat=1; //var for blink


function testho(){ //header loop 
	if(stat<=0){return false;}
	if(stat==1){stat=2;fadeout();jQuery('div#ho').fadeIn('slow').css("background-image","url(images/header/one-gallon.png)").wrap('<a id="atags" href="http://www.ktmfinishes.com/water-base-products/15-solid-colors" title="Water-Born Solid Colors"></a>');return false;}
	if(stat==2){stat=3;fadeout();jQuery('div#ho').fadeIn('slow').css("background-image","url(images/header/water-base.png)").wrap('<a id="atags" href="http://www.ktmfinishes.com/water-base-products/15-solid-colors" title="Water-Born Solid Colors"></a>');return false;}
	if(stat==3){stat=4;fadeout();jQuery('div#ho').fadeIn('slow').css("background-image","url(images/header/mahogany.png)").wrap('<a id="atags" href="http://www.ktmfinishes.com/color-chart" title="View Color Chart"></a>');return false;}
	if(stat==4){stat=5;fadeout();jQuery('div#ho').fadeIn('slow').css("background-image","url(images/header/ktm-9.png)").wrap('<a id="atags" href="http://www.ktmfinishes.com/ktm-9" title="KTM 9 Clear Coat"></a>');return false;}
	if(stat==5){stat=6;fadeout();jQuery('div#ho').fadeIn('slow').css("background-image","url(images/header/ktm-sv.png)").wrap('<a id="atags" href="http://www.ktmfinishes.com/ktm-sv" title="KTM Spar Varnish"></a>');return false;}
	if(stat==6){stat=1;fadeout();jQuery('div#ho').fadeIn('slow').css("background-image","url()").html("<a class='atags' style='color:gold;font-weight:bold;' href='http://www.youtube.com/p/51577A03DD31B967&hl=en&fs=1' target='_blank' title='Watch WoodGraining Videos'>Videos</a><br /><span><object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0' width='400' height='200'><param name='width' value='400' /><param name='height' value='200' /><param name='wmode' value='transparent' /><param name='src' value='images/header/wgk.swf' /><embed type='application/x-shockwave-flash' width='400' height='200' wmode='transparent' src='images/header/wgk.swf'></embed></object></span>");return false;}
} //header loop

/*blink*/ 
function blink(){
if(bstat==1){bstat=2;jQuery('.blink').fadeIn();return false;}
if(bstat==2){bstat=1;jQuery('.blink').fadeOut();return false;}
}


jQuery.noConflict();jQuery(document).ready(function($){ //no conflict onload



//header pause
	$('div#ho').mouseover(function(){statr=stat;stat=0;})
	$('div#ho').mouseout(function(){stat=statr;})
////call header loop
	stat_int=7353; //header loop speed adjustment
	setInterval('testho()',stat_int);  //start header image loop
	//testho(); //test 1st slide

//blink();
setInterval('blink()',1111);  
$('#specials').css("width","68px");
//$('#special1').mouseout(function(){$('#special1').fadeOut();});
////

//sgwgk
$('.sgwgk').click(function(){location.href="#";return false;})


/*showroom fix and other {ozgallerys} on site , put mootools js, caption js and .. back in head tag in index php*/
$('a[href$=show-room]').click(function(){location.href="http://www.ktmfinishes.com/show-room?fix=fixed";return false;})
$('a[href$=finishing-system]').click(function(){location.href="http://www.ktmfinishes.com/water-base-products/coatings-for-wood/21-ktm-Stain%20And%20Grain-finishing-system?fix=fixed";return false;})
$('a[href$=water-base-wood-grain-kit]').click(function(){location.href="http://www.ktmfinishes.com/water-base-wood-grain-kit?fix=fixed";return false;})
$('a[href$=coatings-for-fiberglass-plastic-pvc-a-steel]').click(function(){location.href="http://www.ktmfinishes.com/water-base-products/coatings-for-fiberglass-plastic-pvc-a-steel?fix=fixed";return false;})
$('a[href$=coatings-for-wood]').click(function(){location.href="http://www.ktmfinishes.com/water-base-products/coatings-for-wood?fix=fixed";return false;})
$('a[href$=diy-solid-color-kit]').click(function(){location.href="http://www.ktmfinishes.com/water-base-products/diy-solid-color-kit?fix=fixed";return false;})

/*twitter, rss btn*/
$('#leftmenu').prepend("<div style='padding-bottom:5px;'><a href='http://twitter.com/ktmfinishes'><img style='height:25px;width:25px;' src='http://twitter-badges.s3.amazonaws.com/t_logo-a.png' title='Follow Me!' /></a>&nbsp;<a class='topnava' target='_blank' href='http://www.ktmfinishes.com/index.php?option=com_ninjarsssyndicator&amp;feed_id=3&amp;format=raw'_blank' title='Subscribe'><img id='ninja' style='height:25px;width:25px;' src='images/rss.gif' title='Subscribe'/></a><div>");
//$('#leftmenu').append("<a href='http://twitter.com/KTMFinishes' target='_blank' title='Follow Me'><img src='http://twitter-badges.s3.amazonaws.com/twitter-a.png' /></a>");




/*wrap .contentheading*/
$('.contentheading').wrapInner("<h1></h1>")

/*paragraph fix width*/
$('table.contentpaneopen tbody tr td p.pdwidth1').css('width','500px');

/*search find position*/
$('fieldset>div>a').css("color","blue").css("font-weight","bold").css("position","relative");

/*.bluelink*/
$('a.bluelink').css("color","blue").css("position","relative").css("font-weight","bold").css("cursor","pointer");

/*comparison table adjustments*/
$('div.escroll').css("width","1111px")
$('div.escroll>table').css("width","1600px")

/*master h1*/
////$('table.contentpaneopen>tbody>tr>td.contentheading,.componentheading').css("font-size","225%")
$('table').css("-moz-border-radius","3px").css("-webkit-border-radius","3px").css("overflow","hidden")
$('input,select').css("cursor","pointer")

/*add menus to top#topnavi & popup specials div(sv,9)*/ /*rss*/ 
////$('div#topnavi>ul').prepend("<li><a class='topnava' target='_blank' href='http://www.ktmfinishes.com/index.php?option=com_ninjarsssyndicator&amp;feed_id=3&amp;format=raw'_blank' title='Subscribe'><img id='ninja' style='margin-left:-12px;padding-top:13px;' src='images/rss.gif' title='Subscribe'/></a></li>");
////$('div#topnavi>ul').append('<li><a class="topnava" href="water-base-products/14-woodgrain" title="Water Base WoodGrain Stain">woodgrain</a></li>').append('<li><a class="topnava" href="http://ktmfinishes.com/ktm-opportunities">Opportunities</a></li>').append('<li><a class="topnava" href="http://ww11.aitsafe.com/cf/review.cfm?userid=D9199185" target="_blank" title="Review Shopping Cart">Shopping Cart</a></li>').append('<li><a class="topnava" href="" title="This Months Specials"><span style="font-size:17px;color:gold;" class="blink">Specials</span></a></li><div style="display:none;color:white;position:absolute;top:69px;height:55px;background-color:rgb(0,0,100);border:1px solid black;vertical-align:top;width:77px;left:801px;padding:5px;" id="special1"><a style="font-size:17px;margin-bottom:5px;position:relative;z-index:1;color:gold;" href="http://www.ktmfinishes.com/ktm-sv" title="KTM SV" >KTM SV</a><br /><a style="line-height:2;font-size:17px;margin-bottom:5px;position:relative;z-index:1;color:gold;" href="http://www.ktmfinishes.com/ktm-9" title="KTM 9">KTM 9</a></div>');
$('#specials').click(function(){var doffset = $('#specials').offset();$('#special1').css("left",doffset.left).toggle();return false;}); //// var doffset = $('#specials').offset(); //get specials position (doffset.left)

/*kill ads*/
//$('div#topnavi>ul').append('<a id="stopads" class="topnava" style="color:transparent;cursor:pointer;">X</a>');
//$('a#stopads').click(function(){$('#pic1, #pic2, #pic3, #pic4, #pic5, #pic6, .blink').stop(true,true);})



/*top nav link fix for validator*/
$('a:contains("Home")').attr('href','http://ktmfinishes.com/home');
$('a:contains("About Us")').attr('href','http://ktmfinishes.com/about-us');
$('a:contains("Products")').attr('href','http://ktmfinishes.com/water-base-products').attr('title','Water Base Products');
$('div#topnavi>ul>li>a:contains("Stain And Grain")').attr('href','http://ktmfinishes.com/woodgrain').attr('title','waterbase woodgrain');
$('a:contains("Contact")').attr('href','http://ktmfinishes.com/ktm-finishes-info').attr('title','contact info');
$('a:contains("FAQ")').attr('title','Frequently Asked Questions').attr('href','http://www.ktmfinishes.com/index.php?option=com_content&view=article&id=46&Itemid=63');
//$('div#topnavi>ul>li>a:contains("WoodGrain")').attr('href','water-base-products/14-woodgrain').attr('title','waterbase woodgrain');
//$('ul.menu>li>a>:contains("Stain & Grain")').attr('href','http://ktmfinishes.com/woodgrain').attr('title','waterbase woodgrain');
//$('a:contains("WoodGrain Kit")').attr('href','water-base-wood-grain-kit').attr('title','waterbase woodgraining kit');

/*article list img style*/
$('ul>li').css("listStyleImage","url(/templates/siteground85/images/li.png)");
$('#form-login>ul>li').css("listStyleImage","none");
$('ul.menu>li,#topnavi>ul>li').css("listStyleImage","none");

$('ul.menu>li>ul>li').css("listStyleImage","none");
$('table.contentpaneopen>tbody>tr>td>ul>li').css("paddingLeft","0px").css("marginLeft","27px").css("lineHeight","14px");
$('table>tbody>tr>td>ul>li').css("paddingLeft","0px").css("marginLeft","27px").css("lineHeight","14px");
$('#form-login>ul>li>a').css("font-Size","10px").css("color","white").css("margin-left","-20px");

$('table.contentpaneopen tbody tr td div ul li').css("margin-left","20px");
$('table.contentpaneopen tbody tr td div ul li a').css("cursor","pointer");

//repair rss to show img on every page
//$('ul.menu>li,#topnavi>ul>li>a>img#ninja').css("background-image",url(images/rss.gif));

// tabs spacing
$('table.contentpaneopen tbody tr td div ul.jwts_tabbernav li').css("margin-left","4px");

// mod login links
$('.wlink').css("text-decoration","none");

// global font size
$('table.contentpaneopen tbody tr td,table.contentpaneopen tbody tr td p,table.contentpaneopen tbody tr td div,table.contentpaneopen tbody tr td div p').animate({fontSize:"17px"}).css("line-height","1.2");

$('table.contentpaneopen tbody tr td span').css("font-size","17px").css("padding-top","16px").css("line-height","1.2");
$('table.contentpaneopen tbody tr td ul li').css("font-size","17px").css("line-height","1.3");

//ie li fix
$('li a').css("listStyleImage","none");

/*footer caption / text*/
$('.copyright').html("KTMŪ WoodGrain Finishing System");

/*tooltip msg*/
$('.readon').attr('title','Comment');

/*display:none;*/
//$('div.componentheading:contains("KTM WoodGrain Kits")').html('LOADING...').fadeOut('slow');
$('a#loginr').css("display","none"); 
$('input.button[value^="Results"]').css("display","none")
$('#sitename').css("display","none");
$('.copyright').css("display","none");
$('span:contains("Finishing Steps")').css("display","none").addClass('dud');
$('span:contains("Finished Results")').css("display","none").addClass('dud');

/*remove combobox in voting poll, index.php?option=com_poll&id=1:what-colors-your-grained-door*/ 
$('.componentheading:contains("Finished Results")').css("display","none").addClass('dud');

/*disable .preview click*/
$('.preview').click(function(){return false;});
////
////

/*comparisonchartscroll*/
$('div.escroll').css("overflow","scroll").css("widht","1111px");

// sub menu padding
$('ul>li.item37,ul>li.item38,ul>li.item39,ul>li.item40,ul>li.item41,ul>li.item42,ul>li.item54').addClass("submenus001");
$('.submenus001').animate({paddingBottom:"5px"});

/*frequently-asked-questions WGK*/
$('#faq1,#faq2,#faq3,#faq4,#faq5,#faq06,#faq7,#faq8,#faq9,#faq10').click(function(){location.href="http://www.ktmfinishes.com/index.php?option=com_content&view=article&id=46&Itemid=63#faqA";return false;})
//How do I take care of my new door?
$('#faq1').hover(function(){
$('#faqA').html("<p>Your finished door will give you many years of good service.  Obviously, there will be factors that affect the overall useful life of the finish.  Such factors as application details, weather conditions, and heat can affect that useful life.  Abrasive cleaners should not be used, instead use mild household soap and warm water.</p>")
;})
//How long do I have to wait in-between coats of the Step?
$('#faq2').hover(function(){
$('#faqA').html("<p>KTM will dry quickly in ambient conditions, but high humidity situations may slow the drying process.  Drying times will vary based on temperature and humidity.</p>")
;})
//I have a door that I want to re-finish, can I use KTM WoodGrain to do this?
$('#faq3').hover(function(){
$('#faqA').html("<p>Previously painted fiberglass doors may or may not have to be stripped before re&minus;finishing.  If you&apos;ve used a stain and a clear coat to paint your door previously you&apos;ll probably have to strip the door.  Use a water&minus;based stripper according to the manufacturer&apos;s instructions.  Before applying KTM, be sure to remove any trace of stripper before proceeding with the KTM&minus;WoodGrain Finishing System.</p>")
;})
//I have a lot of brush marks after applying Step 1, what happened?
$('#faq4').hover(function(){
$('#faqA').html("<p>It sounds like the coating was applied to heavy and/or the temperature was too high causing the paint to dry too fast.  Be sure not to apply KTM in direct sunlight.</p>")
;})
//I have a run on the surface of the door.
$('#faq5').hover(function(){
$('#faqA').html("<p>No problem, sand it back and feather into surrounding area, then re-paint to blend in.</p>")
;});
//Its hard to clean out areas around raised panels.
$('#faq06').hover(function(){
$('#faqA').html("<p>Use a fine artist brush to smooth out any residue in corners you can&apos;t get with supplied brush or paper towel.</p>")
;})
//Step 2 is drying too fast. When I apply it feels like it&apos;s locking up or dragging across the surface of the door.
$('#faq7').hover(function(){
$('#faqA').html("<p>There are several possible reasons this is happening.  First, be sure not to apply in direct sunlight.  Exposure to sun causes the surface temperature of the door to rise and dries the paint on the surface.</p><p>It also may indicate that your base coat (Step 1) is not fully cured.  Let it dry longer before applying step 2.</p><p>Your paper towel may be dirty and bogging down due to build up of removed coating on the rag.  Get a new rag or re-fold to use clean area.</p><p>Don&apos;t forget to use KTM Extender prior to application of Step 2.  This will allow ample open time to manipulate product.  Apply lightly&minus;a little goes a long way!</p>")
;})
//There are two-cans with my kit, which one do I use first?
$('#faq8').hover(function(){
$('#faqA').html("<p>The larger can (22 ozs.) is marked Step 1&minus;this is the base coat use this one first.  The smaller can (8 ozs.) marked Step 2 is what highlights the grain on the door.</p>")
;})
//What are the best conditions for drying?
$('#faq9').hover(function(){
$('#faqA').html("<p>Best conditions for the base coat to dry are at 70&deg;F and 50% relative humidity.  In these conditions KTM Step 1 can be ready for 2nd application in 60 minutes.</p>")
;})
//What do I do first?
$('#faq10').hover(function(){
$('#faqA').html("<p>Clean the entire surface of the door using denatured alcohol, or acetone.  If your door has a wood edge scuff sand edge using 220-grit sand paper, then clean entire door with acetone.</p>")
;})
/*/faq*/

/*more*/
/*hide pdf, print & email btns / hide article titles*/
//$('.contentpaneopen').css("position","relative").css("top","-44px");

/*kill ads button*/ 
//$('div#topnavi>ul').append('<li><a id="stopads" class="topnava" title="stop">X</a></li>');
//$('div#topnavi>ul').append('<a id="stopads" class="topnava" style="color:transparent;cursor:pointer;" title="stop">X</a>');


/*credit *http://www.catswhocode.com/blog/how-to-create-a-fancy-image-gallery-with-jquery*/
/*preload img~*/ 
imagePreview();

/*wgk page section*/
	/*when clicked goto topp - woodgrain videos*/
	$('#hd2,#hd11,#hd12,#v0,#v1,#v2,#v3,#v4,#v5').click(function(){location.href="#topp";return false;})

	/*videos*/

	/* step 2 pt 1, CLICK step-2-pt1 - light-oak--video-yt.html */
	$('#hd12').click(function(){$('#hd1div').load('step-2-light-oak--video-yt-p1.html?#topp');return false;;})
	/* step 2 pt 2, CLICK step-2-pt2 - light-oak--video-yt.html */
	$('#hd11').click(function(){$('#hd1div').load('step-2-light-oak--video-yt-p2.html?#topp');return false;;})

	/* CLICK step-1-light-oak-full-video001-nq.html swf yt */ 
	$('#hd2').click(function(){$('#hd1div').load("step-1-light-oak-full-video001-nq.html");
	//$('#embedyt').attr('widht','660px').attr('height','420px');
	;});


	/*panel tweaks, goto #tabs*/
	//$('.jwts_title_left:contains("Finishing Steps")').click(function(){$('#jwts_a4').css("height","420px");});

	//$('.jwts_title_left:contains("Light Oak Series")').click(function(){location.href="#tabs";});
	$('.jwts_title_left:contains("Video And Instructional Series")').click(function(){location.href="#tabs";});
	/*panel swf*/
	$('#v0').click(function(){$('#hd1div').load("v0.php");;});
	$('#v1').click(function(){$('#hd1div').load("v1.php");;});
	$('#v2').click(function(){$('#hd1div').load("v2.php");;});
	$('#v3').click(function(){$('#hd1div').load("v3.php");;});
	$('#v4').click(function(){$('#hd1div').load("v4.php");;});
	$('#v5').click(function(){$('#hd1div').load("v5.php");;});

	$('#hd11,#hd1,#hd2,#hd3,#hd4,#hd5,#hd6,#hd7,#hd8,#hd9,#hd10').css("cursor","pointer");

/*wgk page section*/

;}) ////on load



/*credit *http://www.catswhocode.com/blog/how-to-create-a-fancy-image-gallery-with-jquery*/
/*img preview*/
this.imagePreview = function(){	
	/* CONFIG */
		
		xOffset = 10;
		yOffset = 30;
		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
		
	/* END CONFIG */
	jQuery("a.preview").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		jQuery("body").append("<p id='preview'><img src='"+ this.href +"' alt='Image preview' />"+ c +"</p>");								 
		jQuery("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		jQuery("#preview").remove();
    });	
	jQuery("a.preview").mousemove(function(e){
		jQuery("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};
/*img preview*/