<!--
//*******************************************************
//*                Comment Card Engine                  *
//* This product and other products of OpinionLab, Inc. *
//* are protected by U.S. Patent No. US 6,397,192 B1    *
//* and other patents pending.                          *
//*******************************************************

var alreadysubmitted = false;
var O_Op6=((navigator.userAgent.toLowerCase().indexOf('opera 6')>-1)||(navigator.userAgent.toLowerCase().indexOf('opera/6')>-1))?true:false;
var O_Op7=((navigator.userAgent.toLowerCase().indexOf('opera 7')>-1)||(navigator.userAgent.toLowerCase().indexOf('opera/7')>-1))?true:false;
var O_Op8=((navigator.userAgent.toLowerCase().indexOf('opera 8')>-1)||(navigator.userAgent.toLowerCase().indexOf('opera/8')>-1))?true:false;
var O_Op9=((navigator.userAgent.toLowerCase().indexOf('opera 9')>-1)||(navigator.userAgent.toLowerCase().indexOf('opera/9')>-1))?true:false;
var O_FF15=(navigator.userAgent.toLowerCase().indexOf('firefox/1.5')>-1)?true:false;
var O_FF20=(navigator.userAgent.toLowerCase().indexOf('firefox/2.')>-1)?true:false;
var O_NS5up=((navigator.userAgent.toLowerCase().indexOf('mozilla')!=-1)&&(parseInt(navigator.appVersion)>=5))||O_Op6||O_Op7||O_Op8||O_Op9;
var O_NS4=(document.layers)&&(!O_Op6)&&(!O_Op7)&&(!O_Op8)&&(!O_Op9)?1:0;
var O_IE4=(document.all)&&(!O_Op6)&&(!O_Op7)&&(!O_Op8)&&(!O_Op9)?1:0;
var O_IE6=O_IE4&&navigator.userAgent.toLowerCase().indexOf('msie 6.')>-1;
var O_MAC=(navigator.appVersion.indexOf("Macintosh")>-1);
var O_IE45=(navigator.userAgent.toLowerCase().indexOf('msie 4.')>-1)&&O_MAC&&(!O_Op6)&&(!O_Op7)&&(!O_Op8)&&(!O_Op9);
var O_IE5=(navigator.userAgent.toLowerCase().indexOf('msie 5.0')>-1)&&O_MAC&&(!O_Op6)&&(!O_Op7)&&(!O_Op8)&&(!O_Op9);
var st="";var _d=document;var _w=window;
var topic_selection_mandatory = 0;

var _vH=(O_IE4)?"none":"hidden";var _vS=(O_IE4)?"block":"visible";
var quesNum = 0;
var notClicked = false;
var ny_offset=0;
var comment_category;
var qs = document.location.href;
	
var time1 = (new Date()).getTime();
	
function _GPs(l){var g=(O_IE4)?eval("_d.all('o"+l+"')"):(O_NS5up||O_Op6)?eval("document.getElementById('o"+l+"')"):eval("_d.layers.o"+l);if(O_NS4&&g){return g.pageY}if(O_IE4&&g){return g.offsetTop}if(O_NS5up&&g){return g.offsetTop}}

function _Sh(l,s){var g=(O_IE4)?eval("_d.all('o"+l+"')"):eval("_d.o"+l);g=(O_NS5up)?eval("document.getElementById('o"+l+"')"):g;if(O_NS4&&g)g.visibility=(s)?_vS:_vH;if(O_IE4&&g){g.style.display=(s)?_vS:_vH;g.style.visibility=s?"visible":"hidden";}if(O_NS5up&&g)g.style.visibility=(s)?_vS:_vH}

function _Ps(l,x,y){var g=(O_IE4)?eval("_d.all('o"+l+"')"):eval("_d.o"+l);g=(O_NS5up)?eval("document.getElementById('o"+l+"')"):g;if(O_NS4&&g){g.left=x;g.top=y}if(O_IE4&&g){g.style.left=x;g.style.top=y}if(O_NS5up&&g){g.style.left=x+'px';g.style.top=y+'px'}}

function resize(card_h){
	//self.setResizable = true;	

	if( (navigator.userAgent.toLowerCase().indexOf('aol')==-1) && (navigator.userAgent.toLowerCase().indexOf('avant')==-1) ){
		//self.moveTo((screen.width-535)/2, (screen.height-card_h-100)/2 );
	}
	
	if(O_IE4&&!O_Op6){
		//self.resizeTo(535+10,192+10+10+10+5);
		var yPos = 192 - document.body.clientHeight; 
		var xPos = 535 - document.body.clientWidth; 
		var outerHeight = yPos + card_h; 
		var outerWidth = xPos + 535 + 10; 
		if(navigator.userAgent.toLowerCase().indexOf('msie 4.')>-1){outerHeight+=62;}
		if(navigator.userAgent.toLowerCase().indexOf('aol 8.0')>-1){outerHeight+=-34;outerWidth+=-10}
		if(navigator.userAgent.toLowerCase().indexOf('aol 7.0')>-1){outerHeight+=-34;outerWidth+=-10}
		if(navigator.userAgent.toLowerCase().indexOf('aol 6.0')>-1){outerHeight+=15;outerWidth+=0}
		if(navigator.userAgent.toLowerCase().indexOf('aol 5.0')>-1){outerHeight+=-45;outerWidth+=0}
		//self.resizeTo(outerWidth,outerHeight+15);
	} else {
		var yPos = 192-window.innerHeight;
		var xPos = 535-window.innerWidth;
		if(O_NS4&&!O_Op6){
			var outerWidth = 535;
			//self.resizeTo(outerWidth,card_h-20);
		} else {
			var outerHeight = card_h + window.outerHeight-window.innerHeight;
			var outerWidth = 535 + window.outerWidth-window.innerWidth;
			if(navigator.userAgent.toLowerCase().indexOf('camino')>-1){outerWidth+=15}
			if(O_Op7){outerHeight+=0}
			if(O_Op8||O_Op9){outerHeight+=0}
			if(O_FF15||O_FF20){outerHeight-=12}
			//self.resizeTo(outerWidth,outerHeight);
		}
	}
	//self.setResizable = false;
	self.focus();
	p_rating=fR('rating');
	if(p_rating==1)document.CommentCard.overall[4].checked=true;
	if(p_rating==2)document.CommentCard.overall[3].checked=true;
	if(p_rating==3)document.CommentCard.overall[2].checked=true;
	if(p_rating==4)document.CommentCard.overall[1].checked=true;
	if(p_rating==5)document.CommentCard.overall[0].checked=true;
	
}

function fR(n){i=0;while(i<qs.length){j=i+n.length;if(qs.substring(i,j)==n){k=qs.indexOf('&',j);return unescape(qs.substring(j+1,(k==-1)?qs.length:k))}i++}return ''}

function check() {
	time2 = (new Date()).getTime();
	document.CommentCard.width.value = screen.width;
	document.CommentCard.height.value = screen.height;
	document.CommentCard.prev.value = 'http://'+document.CommentCard.url.value+'/';
	document.CommentCard.referer.value = document.referrer;
	document.CommentCard.time1.value = time1;
	document.CommentCard.time2.value = time2;
	

 var DesignValue = "";
 var ContentValue = "";
 var UsabilityValue = "";
 var OverallValue = "";
 if (alreadysubmitted) return false;
 
  //Test if we have an required email category field
 if(comment_category==1&&document.CommentCard.email_address.value==''){
 	alert('Please choose a feedback category before submitting.');
	return false;
 }
 
 //Test if we have an required topic selector field
if(typeof document.CommentCard.topic_selection!='undefined' && topic_selection_mandatory==1){
	var ts = eval('document.CommentCard.answer_'+document.CommentCard.topic_selection.value);
	if(ts.value=='' || ts.value==0){
		alert('Please choose a topic for your comments before submitting.');
		document.getElementById('tsText').className = "alert";
	return false;
 	}
 }
 
 // Make sure the comment is not longer than 1000 chars
 if(typeof document.CommentCard.comments!='undefined') {
	 if (document.CommentCard.comments.value.length>1000) {
	  document.CommentCard.comments.select();
	  document.CommentCard.comments.focus();
	  alert(comment_message);
	  return false;
	 }
 }
 
  var globalRating = 0.0, totalRating = 0.0;
  
  // Checking if we have CDU section	
  if(typeof document.CommentCard.content!='undefined'){
 
// Checking the Content Rating
if(typeof document.CommentCard.content[0]!='undefined'){
	 for (i=0; i<5; i++) {
	  if (document.CommentCard.content[i].checked=="1") {
	   ContentValue=document.CommentCard.content[i].value;
	   globalRating += parseInt(ContentValue);
	   totalRating += 1;
	  }
	 }
 } else {
	 ContentValue=document.CommentCard.content.value;
	 globalRating += parseInt(ContentValue);
	 totalRating += 1; 
 }
	 
// Checking the Design Rating
if(typeof document.CommentCard.design[0]!='undefined'){
 for (i=0; i<5; i++) {
  if (document.CommentCard.design[i].checked=="1") {
   DesignValue=document.CommentCard.design[i].value;
    globalRating += parseInt(DesignValue);
    totalRating += 1;
  }
 }
} else {
   DesignValue=document.CommentCard.design.value;
   globalRating += parseInt(DesignValue);
   totalRating += 1;
}

 // Checking the Usability Rating
if(typeof document.CommentCard.usability[0]!='undefined'){
 for (i=0; i<5; i++) {
  if (document.CommentCard.usability[i].checked=="1") {
   UsabilityValue=document.CommentCard.usability[i].value;
    globalRating += parseInt(UsabilityValue);
    totalRating += 1;
  }
 }
} else {
  UsabilityValue=document.CommentCard.usability.value;
  globalRating += parseInt(UsabilityValue);
  totalRating += 1;
}
 
 } else {DesignValue=""; ContentValue=""; UsabilityValue="";}
 // Checking the OverAll Rating
 
 
if(typeof document.CommentCard.overall!='undefined') {
 
 
if(typeof document.CommentCard.overall.value!='undefined'){
	OverallValue = document.CommentCard.overall.value;
} else {
 for (i=0; i<5; i++) {
  if(typeof document.CommentCard.overall[i]!='undefined'){
	  if(document.CommentCard.overall[i].checked=="1"){
		OverallValue=document.CommentCard.overall[i].value;
	  }
  }else{OverallValue="0"}
 }
}

} else { OverallValue="0" }

 if (DesignValue=="" && ContentValue=="" && UsabilityValue=="" & OverallValue =="") { 
  alert(submit_message);
  document.getElementById('ovText').className = "alert";
  return false;
 } else {
 	// Check added 5/11/04, make sure global rating is integer otherwise ask again
	var avgRating = Math.round(globalRating/totalRating);
 	if (avgRating != (globalRating/totalRating) && OverallValue=="") {
 		alert(submit_message);
		document.getElementById('ovText').className = "alert";
 		return false;
 	}
 	
  // Make the comment blank is not modified
  if(typeof document.CommentCard.comments!='undefined'){if(!notClicked)document.CommentCard.comments.value=''};
  alreadysubmitted = true;
  return true;
 }
}
function openabout() {
var _rW=screen.width;
var _rH=screen.height;
var lang = window.location.href.substring(window.location.href.indexOf('lang=')+5, window.location.href.indexOf('&time1='));
if(lang==0||lang=="0"||lang==""||lang.length>2){
	window.open('http://www.opinionlab.com/about_this_system.asp')
}else{
	window.open('http://ccc01.opinionlab.com/about20.asp?lang='+lang,'AboutOnlineOpinion','width=330,height=248,screenX='+((_rW-330)/2)+',screenY='+((_rH-248)/2)+',top='+((_rH-248)/2)+',left='+((_rW-330)/2));
}
}

function clearbox(obj){
	if(!notClicked){obj.value='';notClicked=true}
}

function clearother(thisobj){
if(thisobj.value=='other response')thisobj.value='';
}

var clicked = false;

function dropdown_other(l, n, v){
	if(O_NS4){
		return false;
	}else{
		if(v.toLowerCase()=='other'){
			eval("document.CommentCard."+n+"_oth.style.visibility='visible';")
		}else{
			eval("document.CommentCard."+n+"_oth.style.visibility='hidden';")
		}
		return false;
	}
}

function dropdown_other_display(l, n, v){
	if(O_NS4){
		return false;
	}else{
		if(v.toLowerCase()=='other'){
			eval("document.CommentCard."+n+"_oth.style.display='inline';")
		}else{
			eval("document.CommentCard."+n+"_oth.style.display='none';")
		}
		return false;
	}
}

function dropdown_yes(l, n, v){
	if(O_NS4){
		return false;
	}else{
		if(v.toLowerCase()=='yes'){
			eval("document.CommentCard."+n+"_oth.style.visibility='visible';")
		}else{
			eval("document.CommentCard."+n+"_oth.style.visibility='hidden';")
		}
		return false;
	}
}

function dropdown_yes_display(l, n, v){
	if(O_NS4){
		return false;
	}else{
		if(v.toLowerCase()=='yes'){
			eval("document.CommentCard."+n+"_oth.style.display='inline';")
		}else{
			eval("document.CommentCard."+n+"_oth.style.display='none';")
		}
		return false;
	}
}

function dropdown_no(l, n, v){
	if(O_NS4){
		return false;
	}else{
		if(v.toLowerCase()=='no'){
			eval("document.CommentCard."+n+"_oth.style.visibility='visible';")
		}else{
			eval("document.CommentCard."+n+"_oth.style.visibility='hidden';")
		}
		return false;
	}
}

function dropdown_no_display(l, n, v){
	if(O_NS4){
		return false;
	}else{
		if(v.toLowerCase()=='no'){
			eval("document.CommentCard."+n+"_oth.style.display='inline';")
		}else{
			eval("document.CommentCard."+n+"_oth.style.display='none';")
		}
		return false;
	}
}

function oth_reset(n){
	clicked = true;
	eval("document.CommentCard."+n+"_oth.value='';");
	return false;
}
//-->
