function supportsurvey_makeVars(){
var temp="";
var newVars="";
	if(location.search){
	var s = location.search.replace(/[-+!*]/g,"_");
	v = s.substring(s.indexOf("?")+1,s.length);
	var vars = v.split("&");
		for(i=0;i<vars.length;i++){
		temp = 'var '+vars[i].substring(0,vars[i].indexOf("="))+'="'+vars[i].substring(vars[i].indexOf("=")+1,vars[i].length)+'";';
		var newVars = newVars+temp;
		}
	}return(newVars);
}
eval(supportsurvey_makeVars());
function supportsurvey_attEvent(tgt,evt,fnc){
	if (!tgt.eve) tgt.eve={};
	if (!tgt.eve[evt]) tgt.eve[evt]=[];
	var evts = tgt.eve[evt];
	evts[evts.length]=fnc;
}
function trEvent(tgt,evt){
	if (!tgt || !tgt.eve || !tgt.eve[evt]) return;
	var evts = tgt.eve[evt];
	for (var i=0,len=evts.length;i<len;i++) evts[i]();
}
function addEvent(tgt,evt,fnc,cap){
	if (!cap) cap=false;
	if (tgt.addEventListener){
		tgt.addEventListener(evt,fnc,cap);
		return true;
	} else if (tgt.attachEvent) return tgt.attachEvent("on"+evt,fnc);
	else{
		atEvent(tgt,evt,fnc);
		tgt['on'+evt]=function(){ trEvent(tgt,evt) };
	}
}
function supportsurvey_Set_Cookie(name, value, expires, path, domain, secure){
	var today = new Date();
	today.setTime( today.getTime() );
		if ( expires ){
		expires = expires *1000*60*60;
		}
	var expires_date = new Date( today.getTime() + (expires) );
	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
	( ( path ) ? ";path=" + path : "" ) + 
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
}
function supportsurvey_hasCookies(){
supportsurvey_Set_Cookie('test','none',0,'/','kodak.com','');
	if(readCookie('test')){
	return true
	}
supportsurvey_Set_Cookie('test','',-1,'/','kodak.com','');
}
var supportsurvey_divName=0;
function supportsurvey_add(what){
	supportsurvey_divName++;
	var supportsurvey_myDiv=document.createElement('div')
	supportsurvey_myDiv.setAttribute('id', 'div'+supportsurvey_divName);
	//alert('div'+divName);
	supportsurvey_myDiv.innerHTML=what;
	document.body.appendChild(supportsurvey_myDiv);
}

var surveyURL='';

var supportsurvey_loc=unescape(location.href);
var loc_urg = supportsurvey_loc.indexOf("service/publications");
var loc_toc = supportsurvey_loc.lastIndexOf("toc");
var loc_tod = supportsurvey_loc.indexOf("toc.");
var loc_urp = supportsurvey_loc.indexOf("chapsec");
var loc_idx = supportsurvey_loc.indexOf("index");
var loc_idd = supportsurvey_loc.indexOf("index.");
var loc_vew = supportsurvey_loc.indexOf("view");
var loc_tut = supportsurvey_loc.indexOf("service/tutorials");
var loc_tux = supportsurvey_loc.indexOf("service/tutorials/index");
var loc_itg = supportsurvey_loc.indexOf("service/repair/troubleshooting");
var loc_dlx = supportsurvey_loc.indexOf("7895");
var loc_dln = supportsurvey_loc.indexOf("service/downloads");
var loc_dlw = supportsurvey_loc.indexOf("downloadStep=s4");
var loc_psp = supportsurvey_loc.indexOf("service/products");
var loc_faq = supportsurvey_loc.indexOf("7269");
var loc_fqx = supportsurvey_loc.indexOf("7268");
var loc_hub = supportsurvey_loc.indexOf("2/3/10");
var loc_hpq = supportsurvey_loc.indexOf("2/3/10/");
//var loc_fqq = supportsurvey_loc.indexOf("faqQuestion");
var loc_fqq = 1;
var loc_rpx = supportsurvey_loc.indexOf("7162");
var loc_pop = supportsurvey_loc.indexOf("popsurvey=true");

var loc_lca = loc_loc.indexOf("en_US");
var loc_lcb = loc_loc.indexOf("en_GB");

//if(loc_urg != -1 && loc_toc == -1 && loc_idx != -1) {var pop_urx = "1"} else {var pop_urx = "0"};
//if(loc_urg != -1 && loc_toc != -1 && loc_idx != -1 && loc_idd == -1) {var pop_uri = "1"} else {var pop_uri = "0"};
var pop_uri="1";
//if(loc_urg != -1 && loc_toc != -1 && loc_tod != -1 && loc_toc != loc_tod && loc_idx == -1 && loc_idd == -1) {var pop_urt = "1"} else {var pop_urt = "0"};
var pop_urt="0";
//if(loc_urg != -1 && loc_toc != -1 && loc_tod != -1 && loc_toc == loc_tod && loc_idx == -1 && loc_idd == -1 && loc_vew == -1 && loc_urp != -1) {var pop_urg = "1"} else {var pop_urg = "0"};
var pop_urg="1";
if(loc_urg != -1 && loc_toc != -1 && loc_tod != -1 && loc_idx == -1) {var pop_urx = "1"} else {var pop_urx = "0"};

if(loc_itg != -1) {var pop_itg = "1"} else {var pop_itg = "0"};
if(loc_tut != -1 && loc_tux != -1) {var pop_tux = "1"} else {var pop_tux = "0"};
if(loc_tut != -1 && loc_tux == -1) {var pop_tut = "1"} else {var pop_tut = "0"};
if(loc_faq != -1 && loc_fqq != -1) {var pop_faq = "1"} else {var pop_faq = "0"};
if(loc_fqx != -1) {var pop_fqx = "1"} else {var pop_fqx = "0"};
if(loc_dln != -1 && loc_dlw !=-1) {var pop_dln = "1"} else {var pop_dln = "0"};
if(loc_psp != -1) {var pop_psp = "1"} else {var pop_psp = "0"};
if(loc_hub != -1 && loc_hpq == -1) {var pop_hub = "1"} else {var pop_hub = "0"};

//var story_co = readCookie('story');

//alert("saved cookie:" + story_co);

var pop_entry = pop_urt + pop_urg + pop_uri + pop_urx + pop_itg + pop_tux + pop_tut + pop_faq + pop_fqx + pop_dln + pop_psp + pop_hub;

//alert("survey entry:" + pop_entry);

var pop_survey = "0";
var pop_entrytext = "";

//if(loc_lca != -1 || loc_lcb != -1){
if(loc_lca != -1){

if(pop_entry.substring(3,4)=="1") {pop_survey = "1";pop_entrytext="urg";}; //urg
if(pop_entry.substring(4,5)=="1" && loc_pop != -1) {pop_survey = "1";pop_entrytext="itg";};  //validate linkback from itg server
if(pop_entry.substring(5,6)=="1" && loc_pop != -1) {pop_survey = "1";pop_entrytext="tut";};  //close tut popup and reload hub parent
if(pop_entry.substring(10,11)=="1" && loc_pop != -1) {pop_survey = "1";pop_entrytext="tut";};  //close tut popup and reload psp parent
 if(pop_entry.substring(7,8)=="1") {pop_survey = "1";pop_entrytext="faq";}; //faqs


 if(loc_lca!=-1) {surveyURL='https://www.askingforyouropinion.com/R.aspx?a=439';pop_entrytext="us";}; //us
 //331may, 356jul, 380aug, 389sep, 403oct
// if(loc_lcb!=-1) {surveyURL='https://www.askingforyouropinion.com/R.aspx?a=339';pop_entrytext="gb";}; //gb

}

/*
if(story_co.substring(0,1)=="1") {var pop_urx = "1"};
if(story_co.substring(1,2)=="1") {var pop_uri = "1"};
if(story_co.substring(2,3)=="1") {var pop_urt = "1"};
if(story_co.substring(3,4)=="1") {var pop_urg = "1"};
if(story_co.substring(4,5)=="1") {var pop_itg = "1"};
if(story_co.substring(5,6)=="1") {var pop_tux = "1"};
if(story_co.substring(6,7)=="1") {var pop_tut = "1"};
if(story_co.substring(7,8)=="1") {var pop_faq = "1"};
if(story_co.substring(8,9)=="1") {var pop_fqx = "1"};
if(story_co.substring(9,10)=="1") {var pop_dln = "1"};
if(story_co.substring(10,11)=="1") {var pop_psp = "1"};
if(story_co.substring(11,12)=="1") {var pop_hub = "1"};
var pop_cookie = pop_urx + pop_uri + pop_urt + pop_urg + pop_itg + pop_tux + pop_tut + pop_faq + pop_fqx + pop_dln + pop_psp + pop_hub;
supportsurvey_Set_Cookie('story',pop_cookie,60,'/','kodak.com','');
var surveyURL=surveyURL+"&nav="+pop_cookie+"&loc="+pop_entrytext;
//alert("new cookie:" + pop_cookie);
*/
function supportsurvey_newConfirm() {
var supportsurvey_co='';
if(!window.pq_path){pq_path=''};
if(!window.pq_locale){pq_locale=''}else{if(pq_locale.toLowerCase()!='en_us'&&pq_locale.toLowerCase()!='en_gb'){pq_path='204';}}
//if(ekDocumentLocale!='en_US'){pq_path='204';}
//	if(supportsurvey_hasCookies()==true && window.survey_ip!=undefined){
	if(supportsurvey_hasCookies()==true){
//  supportsurvey_Set_Cookie('supportsurvey','none',0,'/','kodak.com','');	
  supportsurvey_co=readCookie('supportsurvey');
//	var supportsurvey_loc=unescape(location.href);
//	var supportsurvey_host=unescape(location.hostname.substring(0,location.hostname.indexOf('.')));

//alert(pop_entry);
//alert(pop_survey);
if(pop_survey=="1"){

	if(supportsurvey_co=='declined'||supportsurvey_co=='done'||supportsurvey_co=='missed'||pq_path=='204'){
		}else if(supportsurvey_co=='offered'){
    supportsurvey_add(supportsurvey_surv1);
		supportsurvey_makeOpaque();
		}else if(supportsurvey_co=='remind'||supportsurvey_co=='started'){
		supportsurvey_add(supportsurvey_surv2);
		supportsurvey_makeOpaque();

//changed else if to else
//uncomment for prod
//		}else if(supportsurvey_co=='none'){
//uncomment for webdev gamble
    } else {

//		  var supportsurvey_cook=unescape(supportsurvey_co)
//     if(supportsurvey_cook!=supportsurvey_loc){
//exclude internal
//				if((survey06_ip.indexOf('165.170.128')==-1&&survey06_ip.indexOf('150.221.24')==-1&&survey06_ip.indexOf('192.232.68')==-1)||loc_pop!=-1){
				var supportsurvey_rand=Math.floor(Math.random()*11);//multiply by n+1
//				var supportsurvey_rand=Math.floor(Math.random()*101);//multiply by n+1
				  //alert(supportsurvey_rand);
					if(((supportsurvey_rand==9||supportsurvey_rand==8||supportsurvey_rand==7||supportsurvey_rand==6||supportsurvey_rand==5||supportsurvey_rand==4||supportsurvey_rand==3||supportsurvey_rand==2||supportsurvey_rand==1)&&pq_locale.toLowerCase()=='en_gb')||(supportsurvey_rand==4&&pq_locale.toLowerCase()=='en_us')||loc_pop!=-1){//random 10%us or 100%gb or explicit yes
//					if(supportsurvey_rand==4||loc_pop!=-1){//random 1% or explicit yes - random applies to urg and faq, tut and itg are opt in
					supportsurvey_Set_Cookie('supportsurvey','offered',60,'/','kodak.com','');
					supportsurvey_add(supportsurvey_surv1);
					supportsurvey_makeOpaque();
//uncomment for prod
//					}else{
//					supportsurvey_Set_Cookie('supportsurvey','missed',60,'/','kodak.com','');
//					}

  				}//end random
//  			}//end exclude internal

//		}else{
//		supportsurvey_Set_Cookie('supportsurvey',supportsurvey_loc,60*24,'/','kodak.com','');
//uncomment for webdev force
//					supportsurvey_Set_Cookie('supportsurvey','offered',60,'/','kodak.com','');
//					supportsurvey_add(supportsurvey_surv1);
//					supportsurvey_makeOpaque();
		}

//alert("Survey URL: " + surveyURL);

    }//end pop_survey		
		
	}
}

function supportsurvey_Pop (url,w,h){
var newWin = window.open(url,'survey','toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,width='+w+',height='+h);
}
function supportsurvey_no(){
supportsurvey_removeDiv();
supportsurvey_Set_Cookie('supportsurvey','declined',60*24*2,'/','kodak.com','');
_hbLink('supportsurvey_no');
}
function supportsurvey_yes(){
supportsurvey_sWinCheck();
supportsurvey_removeDiv();
supportsurvey_Set_Cookie('supportsurvey','started',60,'/','kodak.com','');
_hbLink('supportsurvey_yes');
self.blur();
supportsurvey_add(supportsurvey_surv2);
}
function supportsurvey_later(){
supportsurvey_sWinCheck();
supportsurvey_removeDiv();
supportsurvey_Set_Cookie('supportsurvey','remind',60,'/','kodak.com','');
_hbLink('supportsurvey_later');
supportsurvey_add(supportsurvey_surv2);
window.focus();
}
function supportsurvey_remind(){
supportsurvey_sWinCheck();
supportsurvey_removeDiv();
supportsurvey_Set_Cookie('supportsurvey','started',60,'/','kodak.com','');
_hbLink('supportsurvey_remind');
supportsurvey_add(supportsurvey_surv2);
self.blur();
}

function supportsurvey_removeDiv(){
document.body.removeChild(document.getElementById('div'+supportsurvey_divName));
}
function supportsurvey_sWinCheck(){
//supportsurvey_Pop(surveyURL,700,450);
supportsurvey_Pop(surveyURL,940,600);
}
function supportsurvey_finish(){
supportsurvey_Set_Cookie('supportsurvey','done',60*24*30*6,'/','kodak.com','');
supportsurvey_removeDiv();
}
var supportsurvey_surv1='<div style="position:absolute; top:220px; right:30%; border:1px solid black"><div id="survey" style="width:320px; border:2px solid #ffa827; border-bottom:1px solid white; padding:3px 5px 2px 14px; background-color:#ffffff">'
+'<div align="center" style="width:10px; border:2px solid #ffa827; padding:1px 3px 1px 3px; color:#ffa827; float:right;" onClick="supportsurvey_no()" onMouseOver="this.style.cursor=\'pointer\'"><strong>X</strong></div>'
+'<span class="head1">Kodak.com Survey</span>'
+'</div>'
+'<div id="survey" style="width:320px; display:block; border:2px solid #ffa827; padding:14px 5px 25px 14px; background-color:#ffffff">'
+'Please take a <strong>short survey</strong> to help us improve customer support on kodak.com.&nbsp;&nbsp;'
+'Your input is all we need, no future emails or marketing material will be sent as a result of your participation.'
+'<div style="margin-top:15px" align="center">'
+'<a href="javascript:void[0]" name="&lid=supportsurvey_yes" onClick="supportsurvey_yes();"><img src="/US/images/en/corp/surveys/yes.gif" border="0"></a>'
+'<a href="javascript:void[0]" name="&lid=supportsurvey_no" onClick="supportsurvey_no();"><img src="/US/images/en/corp/surveys/noThanks.gif" border="0" style="margin-left:10px"></a>'
+'</div></div></div>';//<a href="javascript:void[0]" name="&lid=supportsurvey_later" onClick="supportsurvey_later(supportsurvey_surv2);"><img src="/US/images/en/corp/surveys/maybeLater.gif" border="0" style="margin-left:10px"></a>

var supportsurvey_surv2= '<div id="survey" align="right" style="display:block; position:relative; top:-90px; right:10%; z-index:100">'+
'<a href="javascript:void[0]" name="&lid=supportsurvey_remind" onClick="supportsurvey_remind();" class="tnb">Resume Kodak.com Survey</a>'+
'</div>';

function supportsurvey_makeOpaque(){
	var objs = document.getElementsByTagName('object');
	var param = '<param name="wmode" value="opaque" />'
	var embs = document.getElementsByTagName('embed');
	if(objs.length>0){
		for(i=0; i<objs.length;i++){
			if(navigator.userAgent.toLowerCase().indexOf('msie')!=-1){
			objs[i].parentNode.innerHTML = objs[i].parentNode.innerHTML.replace(/Window|window/,'opaque');
			}else{
			embs[i].setAttribute('wmode','opaque');
			objs[i].parentNode.innerHTML = objs[i].parentNode.innerHTML;
			}
		}
	}
}
var supportsurvey_onload = addEvent(window,'load',supportsurvey_newConfirm,false);