﻿
var req;function getAbsX(elt){return(elt.x)?elt.x:getAbsPos(elt,"Left");}
function getAbsY(elt){return(elt.y)?elt.y:getAbsPos(elt,"Top");}
function getAbsPos(elt,which){iPos=0;while(elt!=null){iPos+=elt["offset"+which];elt=elt.offsetParent;}
return iPos;}
function ajaxRequest(p_Form,p_isXml,p_submitMethod,p_parameters,p_url,p_targetDiv){var div=document.getElementById(p_targetDiv);var newdiv=document.createElement('div');var divIdName='divImage';newdiv.setAttribute('id',divIdName);newdiv.style.width=div.offsetWidth+"px";newdiv.style.height=div.offsetHeight+"px";newdiv.style.left=getAbsX(div)+"px";newdiv.style.top=getAbsY(div)+"px";newdiv.style.position="absolute";newdiv.style.background="#FFFFFF";newdiv.style.zIndex="999";newdiv.style.filter="alpha(opacity=80)";newdiv.style.mozOpacity="0.80";newdiv.style.khtmlOpacity="0.80";newdiv.style.opacity="0.80";newdiv.innerHTML="<img src='images/loading3.gif' alt='loading' />";div.appendChild(newdiv);if(p_Form==null){if(window.XMLHttpRequest){req=new XMLHttpRequest();req.onreadystatechange=function(){ajaxResponse(p_targetDiv);};if(p_submitMethod=="POST"){p_url=p_url+"?"+createTimestamp();req.open("POST",p_url,true);req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');if(p_isXml)
{req.setRequestHeader("Content-Type","text/xml");}
req.send(p_parameters);}
else{var ampersand="&";if(p_parameters=="")ampersand="";p_url=p_url+"?"+p_parameters+ampersand+createTimestamp();req.open("GET",p_url,true);if(p_isXml)
{try{req.overrideMimeType('text/xml');}
catch(e)
{}}
req.send(null);}}else if(window.ActiveXObject){req=new ActiveXObject("Microsoft.XMLHTTP");if(req){req.onreadystatechange=function(){ajaxResponse(p_targetDiv);};if(p_submitMethod=="POST"){p_url=p_url+"?"+createTimestamp();req.open("POST",p_url,true);req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');if(p_isXml)
{req.setRequestHeader("Content-Type","text/xml");}
req.send(p_parameters);}
else{var ampersand="&";if(p_parameters=="")ampersand="";p_url=p_url+"?"+p_parameters+ampersand+createTimestamp();req.open("GET",p_url,true);if(p_isXml){req.setRequestHeader("Content-Type","text/xml");}
req.send();}}}}
else{formObject=p_Form;p_url=formObject.action;p_submitMethod=formObject.method;var data="";for(i=0;i<formObject.elements.length;i++){if(formObject.elements[i].type!="submit"||formObject.elements[i].type!="button"){if(i==formObject.elements.length-1){p_parameters+=(formObject.elements[i].name+"="+formObject.elements[i].value)+"";}
else{p_parameters+=(formObject.elements[i].name+"="+formObject.elements[i].value)+"&";}}}
if(window.XMLHttpRequest){req=new XMLHttpRequest();req.onreadystatechange=function(){ajaxResponse(p_targetDiv);};if(p_submitMethod=="POST"){p_url=p_url+"?"+createTimestamp();req.open("POST",p_url,true);req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');if(p_isXml)
{req.setRequestHeader("Content-Type","text/xml");}
req.send(p_parameters);}
else{var ampersand="&";if(p_parameters=="")ampersand="";p_url=p_url+"?"+p_parameters+ampersand+createTimestamp();req.open("GET",p_url,true);if(p_isXml)
{req.overrideMimeType('text/xml');}
req.send(null);}}else if(window.ActiveXObject){req=new ActiveXObject("Microsoft.XMLHTTP");if(req){req.onreadystatechange=function(){ajaxResponse(p_targetDiv);};if(p_submitMethod=="POST"){p_url=p_url+"?"+createTimestamp();req.open("POST",p_url,true);req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');if(p_isXml)
{req.setRequestHeader("Content-Type","text/xml");}
req.send(p_parameters);}
else{var ampersand="&";if(p_parameters=="")ampersand="";p_url=p_url+"?"+p_parameters+ampersand+createTimestamp();req.open("GET",p_url,true);if(p_isXml){req.setRequestHeader("Content-Type","text/xml");}
req.send();}}}}}
function ajaxResponse(p_targetDiv){if(req.readyState==4){if(req.status==200||req.status==304){results=req.responseText;intStartRating();document.getElementById(p_targetDiv).innerHTML=results;$.fn.rating.options={cancel:'Cancel Rating',cancelValue:'',split:0,starWidth:18};$(function(){$('input[type=radio].star').rating();});}else{document.getElementById(p_targetDiv).innerHTML="Please Try Again:\n"+req.status;}}}
function intStartRating()
{;if(window.jQuery)(function($){if($.browser.msie)try{document.execCommand("BackgroundImageCache",false,true)}catch(e){}
$.fn.rating=function(options){if(this.length==0)return this;if(typeof arguments[0]=='string'){if(this.length>1){var args=arguments;return this.each(function(){$.fn.rating.apply($(this),args);});};$.fn.rating[arguments[0]].apply(this,$.makeArray(arguments).slice(1)||[]);return this;};var options=$.extend({},$.fn.rating.options,options||{});this
.not('.star-rating-applied')
.addClass('star-rating-applied')
.each(function(){var eid=(this.name||'unnamed-rating').replace(/\[|\]+/g,"_");var context=$(this.form||document.body);var input=$(this);var raters=context.data('rating')||{count:0};var rater=raters[eid];var control;if(rater)control=rater.data('rating');if(rater&&control){control.count++;}
else{control=$.extend({},options||{},($.metadata?input.metadata():($.meta?input.data():null))||{},{count:0,stars:[],inputs:[]});control.serial=raters.count++;rater=$('<span class="star-rating-control"/>');input.before(rater);rater.addClass('rating-to-be-drawn');if(input.attr('disabled'))control.readOnly=true;rater.append(control.cancel=$('<div class="rating-cancel"><a title="'+control.cancel+'">'+control.cancelValue+'</a></div>')
.mouseover(function(){$(this).rating('drain');$(this).addClass('star-rating-hover');})
.mouseout(function(){$(this).rating('draw');$(this).removeClass('star-rating-hover');})
.click(function(){$(this).rating('select');})
.data('rating',control));};var star=$('<div class="star-rating rater-'+control.serial+'"><a title="'+(this.title||this.value)+'">'+this.value+'</a></div>');rater.append(star);if(this.id)star.attr('id',this.id);if(this.className)star.addClass(this.className);if(control.half)control.split=2;if(typeof control.split=='number'&&control.split>0){var stw=($.fn.width?star.width():0)||control.starWidth;var spi=(control.count%control.split),spw=Math.floor(stw/control.split);star
.width(spw)
.find('a').css({'margin-left':'-'+(spi*spw)+'px'})};if(control.readOnly)
star.addClass('star-rating-readonly');else
star.addClass('star-rating-live')
.mouseover(function(){$(this).rating('fill');$(this).rating('focus');})
.mouseout(function(){$(this).rating('draw');$(this).rating('blur');})
.click(function(){$(this).rating('select');})
;if(this.checked)control.current=star;input.hide();input.change(function(){$(this).rating('select');});star.data('rating.input',input.data('rating.star',star));control.stars[control.stars.length]=star[0];control.inputs[control.inputs.length]=input[0];control.rater=raters[eid]=rater;control.context=context;input.data('rating',control);rater.data('rating',control);star.data('rating',control);context.data('rating',raters);});$('.rating-to-be-drawn').rating('draw').removeClass('rating-to-be-drawn');return this;};$.extend($.fn.rating,{focus:function(){var control=this.data('rating');if(!control)return this;if(!control.focus)return this;var input=$(this).data('rating.input')||$(this.tagName=='INPUT'?this:null);if(control.focus)control.focus.apply(input[0],[input.val(),$('a',input.data('rating.star'))[0]]);},blur:function(){var control=this.data('rating');if(!control)return this;if(!control.blur)return this;var input=$(this).data('rating.input')||$(this.tagName=='INPUT'?this:null);if(control.blur)control.blur.apply(input[0],[input.val(),$('a',input.data('rating.star'))[0]]);},fill:function(){var control=this.data('rating');if(!control)return this;if(control.readOnly)return;this.rating('drain');this.prevAll().andSelf().filter('.rater-'+control.serial).addClass('star-rating-hover');},drain:function(){var control=this.data('rating');if(!control)return this;if(control.readOnly)return;control.rater.children().filter('.rater-'+control.serial).removeClass('star-rating-on').removeClass('star-rating-hover');},draw:function(){var control=this.data('rating');if(!control)return this;this.rating('drain');if(control.current){control.current.data('rating.input').attr('checked','checked');control.current.prevAll().andSelf().filter('.rater-'+control.serial).addClass('star-rating-on');}
else
$(control.inputs).removeAttr('checked');control.cancel[control.readOnly||control.required?'hide':'show']();this.siblings()[control.readOnly?'addClass':'removeClass']('star-rating-readonly');},select:function(value){var control=this.data('rating');if(!control)return this;if(control.readOnly)return;control.current=null;if(typeof value!='undefined'){if(typeof value=='number')
return $(control.stars[value]).rating('select');if(typeof value=='string')
$.each(control.stars,function(){if($(this).data('rating.input').val()==value)$(this).rating('select');});}
else
control.current=this[0].tagName=='INPUT'?this.data('rating.star'):(this.is('.rater-'+control.serial)?this:null);this.data('rating',control);this.rating('draw');var input=$(control.current?control.current.data('rating.input'):null);if(control.callback)control.callback.apply(input[0],[input.val(),$('a',control.current)[0]]);},readOnly:function(toggle,disable){var control=this.data('rating');if(!control)return this;control.readOnly=toggle||toggle==undefined?true:false;if(disable)$(control.inputs).attr("disabled","disabled");else $(control.inputs).removeAttr("disabled");this.data('rating',control);this.rating('draw');},disable:function(){this.rating('readOnly',true,true);},enable:function(){this.rating('readOnly',false,false);}});$.fn.rating.options={cancel:'Cancel Rating',cancelValue:'',split:0,starWidth:18};$(function(){$('input[type=radio].star').rating();});})(jQuery);}
function createTimestamp()
{return"timestamp="+new Date().getTime().toString();}
function makePOSTRequest(url,parameters){http_request=false;if(window.XMLHttpRequest){http_request=new XMLHttpRequest();if(http_request.overrideMimeType){http_request.overrideMimeType('text/html');}}else if(window.ActiveXObject){try{http_request=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{http_request=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}}
if(!http_request){alert('Cannot create XMLHTTP instance');return false;}
http_request.onreadystatechange=alertContents;http_request.open('POST',url,true);http_request.setRequestHeader("Content-type","application/x-www-form-urlencoded");http_request.setRequestHeader("Content-length",parameters.length);http_request.setRequestHeader("Connection","close");http_request.send(parameters);}
function alertContents(){if(http_request.readyState==4){if(http_request.status==200){result=http_request.responseText;document.getElementById('myspan').innerHTML=result;}else{}}}
function setTagSearchTrack(topicname,tagName,application){var xhr;try{xhr=new ActiveXObject('Msxml2.XMLHTTP');}
catch(e)
{try{xhr=new ActiveXObject('Microsoft.XMLHTTP');}
catch(e2)
{try{xhr=new XMLHttpRequest();}
catch(e3){xhr=false;}}}
xhr.onreadystatechange=function()
{if(xhr.readyState==4)
{}};xhr.open("GET","code_setBanner.aspx?Random="+Math.random()+"&topicname="+topicname+"&tagname="+tagName+"&application="+application,true);xhr.send(null);}
