





var leaving=true; // set to false if clicking on an internal link

var nosessioncookie=true;  





function setfalse(){

leaving=false;

//alert("set false");

}



//	document.write("referrre " + document.referrer);

	

	

// following 2 values also need to be changed in icexitsurveyprompt.htm

var surveyVersion = "1";              // cookie value

var surveyInstance = "IBMDesign";       // cookie name



function launchExitSurvey(){

	

			

		if (get_sessionCookie("design_session")=="yes"){

				nosessioncookie=false;

			}

				



//alert ("launch exit survey");

 // code to set event on top frame to launch survey prompt upon unload

 var checkLeave = false;

 if (top.window.disableLeave) checkLeave=true;

 if (checkLeave) {

    if (!top.window.leavingSite) return;

 }

 var wnd=null;

 

 if (getCookie(surveyInstance) != surveyVersion && leaving && nosessioncookie){

 			if (document.domain=="gwareview.boulder.ibm.com"){

     //alert("window open!");

       wnd=window.open('http://gwareview.boulder.ibm.com/software/ucd/exitpopup.html?noframes=true&nosurvey=true', 'exitpopup', 'height=258,width=390,screenX=30,screenY=20,top=20,left=30,status=no,location=no,toolbar=no,directories=no,menubar=no,resizable=no,scrollbars=auto'); 

      

      }

      else

      	wnd=window.open('http://www.ibm.com/software/ucd/exitpopup.html?noframes=true&nosurvey=true', 'exitpopup', 'height=258,width=390,screenX=30,screenY=20,top=20,left=30,status=no,location=no,toolbar=no,directories=no,menubar=no,resizable=no,scrollbars=auto'); 

       wnd.focus();

 }

}

// Retrieve a named cookie value

// from //www.ibm.com/common/cookie/cookie.js for offline use

function getCookie(name) {

    var dc = document.cookie;

    // find beginning of cookie value in document.cookie

    // Note: cookie with more specific path comes first!

    var prefix = name + "=";

    var begin = dc.indexOf(prefix);

    if (begin == -1) {

        return null;

    }

    else if (begin > 0) {

        begin = dc.indexOf("; " + prefix);

        if (begin == -1) {

            return null;

        }

        else {

            begin += 2;

        }

    }



    // find end of cookie value

    var end = document.cookie.indexOf(";", begin);

    if (end == -1) end = dc.length;



    // return cookie value

    return unescape(dc.substring(begin + prefix.length, end));

}





				function get_sessionCookie(Name) {

					var search = Name + "="

					var returnvalue = "";

					if (document.cookie.length > 0) {

						offset = document.cookie.indexOf(search)

						// if cookie exists

						if (offset != -1) {

							offset += search.length

							// set index of beginning of value

							end = document.cookie.indexOf(";", offset);

							// set index of end of cookie value

							if (end == -1) end = document.cookie.length;

							returnvalue=unescape(document.cookie.substring(offset, end))

						}

					}

					return returnvalue;

				}









this.onunload = launchExitSurvey;

