/**
 * For popping the ses intercept thick box
 * requires: thickbox.js, jquery.js, jquery_cookies.js
 * 
 * 
 * 
 */


$(function(){

		//set to 'on' or 'off' to activate/deactivate the ses survey
		var ses_status = "off";
	
		var seshref = window.location.href;
		var hrefEsp = seshref.indexOf("lang=esp");
		var sesclicks = $.cookies.get("tm_ses");
		var seslinks = $.cookies.get("tm_ses_links");

		if(hrefEsp == -1 && ses_status == "on")//only record englis page loads when set to "on"
		{
			if(sesclicks < 6){
				
				//set the page path for hacking omniture (read on ses popup jsp).
				seslinks += " | "+seshref;
				$.cookies.set("tm_ses_links", seslinks)
			}
			
			if(sesclicks != null){
				
				$.cookies.set("tm_ses", ++sesclicks) // increment it
			
				if(sesclicks == 5){
					//alert("show ses"); //show the ses popup on the 5th page view (4th click)
					tb_show("Todaysmilitary.com Survey", "/popup/ses?keepThis=true&amp;TB_iframe=true&amp;width=500&height=350", "")
				}
			}
			else{
				$.cookies.set("tm_ses", 1) // set it to 1 pageview
				$.cookies.set("tm_ses_links", seshref) // set it to 1 pageview
			}
		}

});
