var thumbnailviewer={enableTitle:true,enableAnimation:true,definefooter:'<div class="footerbar">CLOSE X</div>',defineLoading:'<img src="loading.gif" /> Loading Image...',scrollbarwidth:16,opacitystring:'filter:progid:DXImageTransform.Microsoft.alpha(opacity=10); -moz-opacity: 0.1; opacity: 0.1',targetlinks:[],createthumbBox:function(){document.write('<div id="thumbBox" onClick="thumbnailviewer.closeit()"><div id="thumbImage"></div>'+this.definefooter+'</div>')
document.write('<div id="thumbLoading">'+this.defineLoading+'</div>')
this.thumbBox=document.getElementById("thumbBox")
this.thumbImage=document.getElementById("thumbImage")
this.thumbLoading=document.getElementById("thumbLoading")
this.standardbody=(document.compatMode=="CSS1Compat")?document.documentElement:document.body},centerDiv:function(divobj){var ie=document.all&&!window.opera
var dom=document.getElementById
var scroll_top=(ie)?this.standardbody.scrollTop:window.pageYOffset
var scroll_left=(ie)?this.standardbody.scrollLeft:window.pageXOffset
var docwidth=(ie)?this.standardbody.clientWidth:window.innerWidth-this.scrollbarwidth
var docheight=(ie)?this.standardbody.clientHeight:window.innerHeight
var docheightcomplete=(this.standardbody.offsetHeight>this.standardbody.scrollHeight)?this.standardbody.offsetHeight:this.standardbody.scrollHeight
var objwidth=divobj.offsetWidth
var objheight=divobj.offsetHeight
var topposition=(docheight>objheight)?scroll_top+docheight/2-objheight/2+"px":scroll_top+10+"px"
divobj.style.left=docwidth/2-objwidth/2+"px"
divobj.style.top=Math.floor(parseInt(topposition))+"px"
divobj.style.visibility="visible"},showthumbBox:function(){thumbnailviewer.thumbLoading.style.visibility="hidden"
this.centerDiv(this.thumbBox)
if(this.enableAnimation){this.currentopacity=0.1
this.opacitytimer=setInterval("thumbnailviewer.opacityanimation()",20)}},loadimage:function(link){if(this.thumbBox.style.visibility=="visible")
this.closeit()
var imageHTML='<img src="'+link.getAttribute("href")+'" style="'+this.opacitystring+'" />'
if(this.enableTitle&&link.getAttribute("title"))
imageHTML+='<br />'+link.getAttribute("title")
this.centerDiv(this.thumbLoading)
this.thumbImage.innerHTML=imageHTML
this.featureImage=this.thumbImage.getElementsByTagName("img")[0]
if(this.featureImage.complete)
thumbnailviewer.showthumbBox()
else{this.featureImage.onload=function(){thumbnailviewer.showthumbBox()}}
if(document.all&&!window.createPopup)
this.featureImage.src=link.getAttribute("href")
this.featureImage.onerror=function(){thumbnailviewer.thumbLoading.style.visibility="hidden"}},setimgopacity:function(value){var targetobject=this.featureImage
if(targetobject.filters&&targetobject.filters[0]){if(typeof targetobject.filters[0].opacity=="number")
targetobject.filters[0].opacity=value*100
else
targetobject.style.filter="alpha(opacity="+value*100+")"}
else if(typeof targetobject.style.MozOpacity!="undefined")
targetobject.style.MozOpacity=value
else if(typeof targetobject.style.opacity!="undefined")
targetobject.style.opacity=value
else
this.stopanimation()},opacityanimation:function(){this.setimgopacity(this.currentopacity)
this.currentopacity+=0.1
if(this.currentopacity>1)
this.stopanimation()},stopanimation:function(){if(typeof this.opacitytimer!="undefined")
clearInterval(this.opacitytimer)},closeit:function(){this.stopanimation()
this.thumbBox.style.visibility="hidden"
this.thumbImage.innerHTML=""
this.thumbBox.style.left="-2000px"
this.thumbBox.style.top="-2000px"},cleanup:function(){this.thumbLoading=null
if(this.featureImage)this.featureImage.onload=null
this.featureImage=null
this.thumbImage=null
for(var i=0;i<this.targetlinks.length;i++)
this.targetlinks[i].onclick=null
this.thumbBox=null},dotask:function(target,functionref,tasktype){var tasktype=(window.addEventListener)?tasktype:"on"+tasktype
if(target.addEventListener)
target.addEventListener(tasktype,functionref,false)
else if(target.attachEvent)
target.attachEvent(tasktype,functionref)},init:function(){if(!this.enableAnimation)
this.opacitystring=""
var pagelinks=document.getElementsByTagName("a")
for(var i=0;i<pagelinks.length;i++){if(pagelinks[i].getAttribute("rel")&&pagelinks[i].getAttribute("rel")=="thumbnail"){pagelinks[i].onclick=function(){thumbnailviewer.stopanimation()
thumbnailviewer.loadimage(this)
return false}
this.targetlinks[this.targetlinks.length]=pagelinks[i]}}
this.dotask(window,function(){if(thumbnailviewer.thumbBox.style.visibility=="visible")thumbnailviewer.centerDiv(thumbnailviewer.thumbBox)},"resize")}}
thumbnailviewer.createthumbBox()
thumbnailviewer.dotask(window,function(){thumbnailviewer.init()},"load")
thumbnailviewer.dotask(window,function(){thumbnailviewer.cleanup()},"unload");var Prototype={Version:'1.5.0_rc0',ScriptFragment:'(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)',emptyFunction:function(){},K:function(x){return x}}
var Class={create:function(){return function(){this.initialize.apply(this,arguments);}}}
var Abstract=new Object();Object.extend=function(destination,source){for(var property in source){destination[property]=source[property];}
return destination;}
Object.inspect=function(object){try{if(object==undefined)return'undefined';if(object==null)return'null';return object.inspect?object.inspect():object.toString();}catch(e){if(e instanceof RangeError)return'...';throw e;}}
Function.prototype.bind=function(){var __method=this,args=$A(arguments),object=args.shift();return function(){return __method.apply(object,args.concat($A(arguments)));}}
Function.prototype.bindAsEventListener=function(object){var __method=this;return function(event){return __method.call(object,event||window.event);}}
Object.extend(Number.prototype,{toColorPart:function(){var digits=this.toString(16);if(this<16)return'0'+digits;return digits;},succ:function(){return this+1;},times:function(iterator){$R(0,this,true).each(iterator);return this;}});var Try={these:function(){var returnValue;for(var i=0;i<arguments.length;i++){var lambda=arguments[i];try{returnValue=lambda();break;}catch(e){}}
return returnValue;}}
var PeriodicalExecuter=Class.create();PeriodicalExecuter.prototype={initialize:function(callback,frequency){this.callback=callback;this.frequency=frequency;this.currentlyExecuting=false;this.registerCallback();},registerCallback:function(){setInterval(this.onTimerEvent.bind(this),this.frequency*1000);},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.callback();}finally{this.currentlyExecuting=false;}}}}
Object.extend(String.prototype,{gsub:function(pattern,replacement){var result='',source=this,match;replacement=arguments.callee.prepareReplacement(replacement);while(source.length>0){if(match=source.match(pattern)){result+=source.slice(0,match.index);result+=(replacement(match)||'').toString();source=source.slice(match.index+match[0].length);}else{result+=source,source='';}}
return result;},sub:function(pattern,replacement,count){replacement=this.gsub.prepareReplacement(replacement);count=count===undefined?1:count;return this.gsub(pattern,function(match){if(--count<0)return match[0];return replacement(match);});},scan:function(pattern,iterator){this.gsub(pattern,iterator);return this;},truncate:function(length,truncation){length=length||30;truncation=truncation===undefined?'...':truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation:this;},strip:function(){return this.replace(/^\s+/,'').replace(/\s+$/,'');},stripTags:function(){return this.replace(/<\/?[^>]+>/gi,'');},stripScripts:function(){return this.replace(new RegExp(Prototype.ScriptFragment,'img'),'');},extractScripts:function(){var matchAll=new RegExp(Prototype.ScriptFragment,'img');var matchOne=new RegExp(Prototype.ScriptFragment,'im');return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||['',''])[1];});},evalScripts:function(){return this.extractScripts().map(function(script){return eval(script)});},escapeHTML:function(){var div=document.createElement('div');var text=document.createTextNode(this);div.appendChild(text);return div.innerHTML;},unescapeHTML:function(){var div=document.createElement('div');div.innerHTML=this.stripTags();return div.childNodes[0]?div.childNodes[0].nodeValue:'';},toQueryParams:function(){var pairs=this.match(/^\??(.*)$/)[1].split('&');return pairs.inject({},function(params,pairString){var pair=pairString.split('=');params[pair[0]]=pair[1];return params;});},toArray:function(){return this.split('');},camelize:function(){var oStringList=this.split('-');if(oStringList.length==1)return oStringList[0];var camelizedString=this.indexOf('-')==0?oStringList[0].charAt(0).toUpperCase()+oStringList[0].substring(1):oStringList[0];for(var i=1,len=oStringList.length;i<len;i++){var s=oStringList[i];camelizedString+=s.charAt(0).toUpperCase()+s.substring(1);}
return camelizedString;},inspect:function(){return"'"+this.replace(/\\/g,'\\\\').replace(/'/g,'\\\'')+"'";}});String.prototype.gsub.prepareReplacement=function(replacement){if(typeof replacement=='function')return replacement;var template=new Template(replacement);return function(match){return template.evaluate(match)};}
String.prototype.parseQuery=String.prototype.toQueryParams;var Template=Class.create();Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;Template.prototype={initialize:function(template,pattern){this.template=template.toString();this.pattern=pattern||Template.Pattern;},evaluate:function(object){return this.template.gsub(this.pattern,function(match){var before=match[1];if(before=='\\')return match[2];return before+(object[match[3]]||'').toString();});}}
var $break=new Object();var $continue=new Object();var Enumerable={each:function(iterator){var index=0;try{this._each(function(value){try{iterator(value,index++);}catch(e){if(e!=$continue)throw e;}});}catch(e){if(e!=$break)throw e;}},all:function(iterator){var result=true;this.each(function(value,index){result=result&&!!(iterator||Prototype.K)(value,index);if(!result)throw $break;});return result;},any:function(iterator){var result=true;this.each(function(value,index){if(result=!!(iterator||Prototype.K)(value,index))
throw $break;});return result;},collect:function(iterator){var results=[];this.each(function(value,index){results.push(iterator(value,index));});return results;},detect:function(iterator){var result;this.each(function(value,index){if(iterator(value,index)){result=value;throw $break;}});return result;},findAll:function(iterator){var results=[];this.each(function(value,index){if(iterator(value,index))
results.push(value);});return results;},grep:function(pattern,iterator){var results=[];this.each(function(value,index){var stringValue=value.toString();if(stringValue.match(pattern))
results.push((iterator||Prototype.K)(value,index));})
return results;},include:function(object){var found=false;this.each(function(value){if(value==object){found=true;throw $break;}});return found;},inject:function(memo,iterator){this.each(function(value,index){memo=iterator(memo,value,index);});return memo;},invoke:function(method){var args=$A(arguments).slice(1);return this.collect(function(value){return value[method].apply(value,args);});},max:function(iterator){var result;this.each(function(value,index){value=(iterator||Prototype.K)(value,index);if(result==undefined||value>=result)
result=value;});return result;},min:function(iterator){var result;this.each(function(value,index){value=(iterator||Prototype.K)(value,index);if(result==undefined||value<result)
result=value;});return result;},partition:function(iterator){var trues=[],falses=[];this.each(function(value,index){((iterator||Prototype.K)(value,index)?trues:falses).push(value);});return[trues,falses];},pluck:function(property){var results=[];this.each(function(value,index){results.push(value[property]);});return results;},reject:function(iterator){var results=[];this.each(function(value,index){if(!iterator(value,index))
results.push(value);});return results;},sortBy:function(iterator){return this.collect(function(value,index){return{value:value,criteria:iterator(value,index)};}).sort(function(left,right){var a=left.criteria,b=right.criteria;return a<b?-1:a>b?1:0;}).pluck('value');},toArray:function(){return this.collect(Prototype.K);},zip:function(){var iterator=Prototype.K,args=$A(arguments);if(typeof args.last()=='function')
iterator=args.pop();var collections=[this].concat(args).map($A);return this.map(function(value,index){return iterator(collections.pluck(index));});},inspect:function(){return'#<Enumerable:'+this.toArray().inspect()+'>';}}
Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray});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;}}
Object.extend(Array.prototype,Enumerable);if(!Array.prototype._reverse)
Array.prototype._reverse=Array.prototype.reverse;Object.extend(Array.prototype,{_each:function(iterator){for(var i=0;i<this.length;i++)
iterator(this[i]);},clear:function(){this.length=0;return this;},first:function(){return this[0];},last:function(){return this[this.length-1];},compact:function(){return this.select(function(value){return value!=undefined||value!=null;});},flatten:function(){return this.inject([],function(array,value){return array.concat(value&&value.constructor==Array?value.flatten():[value]);});},without:function(){var values=$A(arguments);return this.select(function(value){return!values.include(value);});},indexOf:function(object){for(var i=0;i<this.length;i++)
if(this[i]==object)return i;return-1;},reverse:function(inline){return(inline!==false?this:this.toArray())._reverse();},inspect:function(){return'['+this.map(Object.inspect).join(', ')+']';}});var Hash={_each:function(iterator){for(var key in this){var value=this[key];if(typeof value=='function')continue;var pair=[key,value];pair.key=key;pair.value=value;iterator(pair);}},keys:function(){return this.pluck('key');},values:function(){return this.pluck('value');},merge:function(hash){return $H(hash).inject($H(this),function(mergedHash,pair){mergedHash[pair.key]=pair.value;return mergedHash;});},toQueryString:function(){return this.map(function(pair){return pair.map(encodeURIComponent).join('=');}).join('&');},inspect:function(){return'#<Hash:{'+this.map(function(pair){return pair.map(Object.inspect).join(': ');}).join(', ')+'}>';}}
function $H(object){var hash=Object.extend({},object||{});Object.extend(hash,Enumerable);Object.extend(hash,Hash);return hash;}
ObjectRange=Class.create();Object.extend(ObjectRange.prototype,Enumerable);Object.extend(ObjectRange.prototype,{initialize:function(start,end,exclusive){this.start=start;this.end=end;this.exclusive=exclusive;},_each:function(iterator){var value=this.start;do{iterator(value);value=value.succ();}while(this.include(value));},include:function(value){if(value<this.start)
return false;if(this.exclusive)
return value<this.end;return value<=this.end;}});var $R=function(start,end,exclusive){return new ObjectRange(start,end,exclusive);}
var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest()},function(){return new ActiveXObject('Msxml2.XMLHTTP')},function(){return new ActiveXObject('Microsoft.XMLHTTP')})||false;},activeRequestCount:0}
Ajax.Responders={responders:[],_each:function(iterator){this.responders._each(iterator);},register:function(responderToAdd){if(!this.include(responderToAdd))
this.responders.push(responderToAdd);},unregister:function(responderToRemove){this.responders=this.responders.without(responderToRemove);},dispatch:function(callback,request,transport,json){this.each(function(responder){if(responder[callback]&&typeof responder[callback]=='function'){try{responder[callback].apply(responder,[request,transport,json]);}catch(e){}}});}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++;},onComplete:function(){Ajax.activeRequestCount--;}});Ajax.Base=function(){};Ajax.Base.prototype={setOptions:function(options){this.options={method:'post',asynchronous:true,contentType:'application/x-www-form-urlencoded',parameters:''}
Object.extend(this.options,options||{});},responseIsSuccess:function(){return this.transport.status==undefined||this.transport.status==0||(this.transport.status>=200&&this.transport.status<300);},responseIsFailure:function(){return!this.responseIsSuccess();}}
Ajax.Request=Class.create();Ajax.Request.Events=['Uninitialized','Loading','Loaded','Interactive','Complete'];Ajax.Request.prototype=Object.extend(new Ajax.Base(),{initialize:function(url,options){this.transport=Ajax.getTransport();this.setOptions(options);this.request(url);},request:function(url){var parameters=this.options.parameters||'';if(parameters.length>0)parameters+='&_=';try{this.url=url;if(this.options.method=='get'&&parameters.length>0)
this.url+=(this.url.match(/\?/)?'&':'?')+parameters;Ajax.Responders.dispatch('onCreate',this,this.transport);this.transport.open(this.options.method,this.url,this.options.asynchronous);if(this.options.asynchronous){this.transport.onreadystatechange=this.onStateChange.bind(this);setTimeout((function(){this.respondToReadyState(1)}).bind(this),10);}
this.setRequestHeaders();var body=this.options.postBody?this.options.postBody:parameters;this.transport.send(this.options.method=='post'?body:null);}catch(e){this.dispatchException(e);}},setRequestHeaders:function(){var requestHeaders=['X-Requested-With','XMLHttpRequest','X-Prototype-Version',Prototype.Version,'Accept','text/javascript, text/html, application/xml, text/xml, */*'];if(this.options.method=='post'){requestHeaders.push('Content-type',this.options.contentType);if(this.transport.overrideMimeType)
requestHeaders.push('Connection','close');}
if(this.options.requestHeaders)
requestHeaders.push.apply(requestHeaders,this.options.requestHeaders);for(var i=0;i<requestHeaders.length;i+=2)
this.transport.setRequestHeader(requestHeaders[i],requestHeaders[i+1]);},onStateChange:function(){var readyState=this.transport.readyState;if(readyState!=1)
this.respondToReadyState(this.transport.readyState);},header:function(name){try{return this.transport.getResponseHeader(name);}catch(e){}},evalJSON:function(){try{return eval('('+this.header('X-JSON')+')');}catch(e){}},evalResponse:function(){try{return eval(this.transport.responseText);}catch(e){this.dispatchException(e);}},respondToReadyState:function(readyState){var event=Ajax.Request.Events[readyState];var transport=this.transport,json=this.evalJSON();if(event=='Complete'){try{(this.options['on'+this.transport.status]||this.options['on'+(this.responseIsSuccess()?'Success':'Failure')]||Prototype.emptyFunction)(transport,json);}catch(e){this.dispatchException(e);}
if((this.header('Content-type')||'').match(/^text\/javascript/i))
this.evalResponse();}
try{(this.options['on'+event]||Prototype.emptyFunction)(transport,json);Ajax.Responders.dispatch('on'+event,this,transport,json);}catch(e){this.dispatchException(e);}
if(event=='Complete')
this.transport.onreadystatechange=Prototype.emptyFunction;},dispatchException:function(exception){(this.options.onException||Prototype.emptyFunction)(this,exception);Ajax.Responders.dispatch('onException',this,exception);}});Ajax.Updater=Class.create();Object.extend(Object.extend(Ajax.Updater.prototype,Ajax.Request.prototype),{initialize:function(container,url,options){this.containers={success:container.success?$(container.success):$(container),failure:container.failure?$(container.failure):(container.success?null:$(container))}
this.transport=Ajax.getTransport();this.setOptions(options);var onComplete=this.options.onComplete||Prototype.emptyFunction;this.options.onComplete=(function(transport,object){this.updateContent();onComplete(transport,object);}).bind(this);this.request(url);},updateContent:function(){var receiver=this.responseIsSuccess()?this.containers.success:this.containers.failure;var response=this.transport.responseText;if(!this.options.evalScripts)
response=response.stripScripts();if(receiver){if(this.options.insertion){new this.options.insertion(receiver,response);}else{Element.update(receiver,response);}}
if(this.responseIsSuccess()){if(this.onComplete)
setTimeout(this.onComplete.bind(this),10);}}});Ajax.PeriodicalUpdater=Class.create();Ajax.PeriodicalUpdater.prototype=Object.extend(new Ajax.Base(),{initialize:function(container,url,options){this.setOptions(options);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=container;this.url=url;this.start();},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent();},stop:function(){this.updater.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments);},updateComplete:function(request){if(this.options.decay){this.decay=(request.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=request.responseText;}
this.timer=setTimeout(this.onTimerEvent.bind(this),this.decay*this.frequency*1000);},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options);}});function $(){var results=[],element;for(var i=0;i<arguments.length;i++){element=arguments[i];if(typeof element=='string')
element=document.getElementById(element);results.push(Element.extend(element));}
return results.length<2?results[0]:results;}
document.getElementsByClassName=function(className,parentElement){var children=($(parentElement)||document.body).getElementsByTagName('*');return $A(children).inject([],function(elements,child){if(child.className.match(new RegExp("(^|\\s)"+className+"(\\s|$)")))
elements.push(Element.extend(child));return elements;});}
if(!window.Element)
var Element=new Object();Element.extend=function(element){if(!element)return;if(_nativeExtensions)return element;if(!element._extended&&element.tagName&&element!=window){var methods=Element.Methods,cache=Element.extend.cache;for(property in methods){var value=methods[property];if(typeof value=='function')
element[property]=cache.findOrStore(value);}}
element._extended=true;return element;}
Element.extend.cache={findOrStore:function(value){return this[value]=this[value]||function(){return value.apply(null,[this].concat($A(arguments)));}}}
Element.Methods={visible:function(element){return $(element).style.display!='none';},toggle:function(){for(var i=0;i<arguments.length;i++){var element=$(arguments[i]);Element[Element.visible(element)?'hide':'show'](element);}},hide:function(){for(var i=0;i<arguments.length;i++){var element=$(arguments[i]);element.style.display='none';}},show:function(){for(var i=0;i<arguments.length;i++){var element=$(arguments[i]);element.style.display='';}},remove:function(element){element=$(element);element.parentNode.removeChild(element);},update:function(element,html){$(element).innerHTML=html.stripScripts();setTimeout(function(){html.evalScripts()},10);},replace:function(element,html){element=$(element);if(element.outerHTML){element.outerHTML=html.stripScripts();}else{var range=element.ownerDocument.createRange();range.selectNodeContents(element);element.parentNode.replaceChild(range.createContextualFragment(html.stripScripts()),element);}
setTimeout(function(){html.evalScripts()},10);},getHeight:function(element){element=$(element);return element.offsetHeight;},classNames:function(element){return new Element.ClassNames(element);},hasClassName:function(element,className){if(!(element=$(element)))return;return Element.classNames(element).include(className);},addClassName:function(element,className){if(!(element=$(element)))return;return Element.classNames(element).add(className);},removeClassName:function(element,className){if(!(element=$(element)))return;return Element.classNames(element).remove(className);},cleanWhitespace:function(element){element=$(element);for(var i=0;i<element.childNodes.length;i++){var node=element.childNodes[i];if(node.nodeType==3&&!/\S/.test(node.nodeValue))
Element.remove(node);}},empty:function(element){return $(element).innerHTML.match(/^\s*$/);},childOf:function(element,ancestor){element=$(element),ancestor=$(ancestor);while(element=element.parentNode)
if(element==ancestor)return true;return false;},scrollTo:function(element){element=$(element);var x=element.x?element.x:element.offsetLeft,y=element.y?element.y:element.offsetTop;window.scrollTo(x,y);},getStyle:function(element,style){element=$(element);var value=element.style[style.camelize()];if(!value){if(document.defaultView&&document.defaultView.getComputedStyle){var css=document.defaultView.getComputedStyle(element,null);value=css?css.getPropertyValue(style):null;}else if(element.currentStyle){value=element.currentStyle[style.camelize()];}}
if(window.opera&&['left','top','right','bottom'].include(style))
if(Element.getStyle(element,'position')=='static')value='auto';return value=='auto'?null:value;},setStyle:function(element,style){element=$(element);for(var name in style)
element.style[name.camelize()]=style[name];},getDimensions:function(element){element=$(element);if(Element.getStyle(element,'display')!='none')
return{width:element.offsetWidth,height:element.offsetHeight};var els=element.style;var originalVisibility=els.visibility;var originalPosition=els.position;els.visibility='hidden';els.position='absolute';els.display='';var originalWidth=element.clientWidth;var originalHeight=element.clientHeight;els.display='none';els.position=originalPosition;els.visibility=originalVisibility;return{width:originalWidth,height:originalHeight};},makePositioned:function(element){element=$(element);var pos=Element.getStyle(element,'position');if(pos=='static'||!pos){element._madePositioned=true;element.style.position='relative';if(window.opera){element.style.top=0;element.style.left=0;}}},undoPositioned:function(element){element=$(element);if(element._madePositioned){element._madePositioned=undefined;element.style.position=element.style.top=element.style.left=element.style.bottom=element.style.right='';}},makeClipping:function(element){element=$(element);if(element._overflow)return;element._overflow=element.style.overflow;if((Element.getStyle(element,'overflow')||'visible')!='hidden')
element.style.overflow='hidden';},undoClipping:function(element){element=$(element);if(element._overflow)return;element.style.overflow=element._overflow;element._overflow=undefined;}}
Object.extend(Element,Element.Methods);var _nativeExtensions=false;if(!HTMLElement&&/Konqueror|Safari|KHTML/.test(navigator.userAgent)){var HTMLElement={}
HTMLElement.prototype=document.createElement('div').__proto__;}
Element.addMethods=function(methods){Object.extend(Element.Methods,methods||{});if(typeof HTMLElement!='undefined'){var methods=Element.Methods,cache=Element.extend.cache;for(property in methods){var value=methods[property];if(typeof value=='function')
HTMLElement.prototype[property]=cache.findOrStore(value);}
_nativeExtensions=true;}}
Element.addMethods();var Toggle=new Object();Toggle.display=Element.toggle;Abstract.Insertion=function(adjacency){this.adjacency=adjacency;}
Abstract.Insertion.prototype={initialize:function(element,content){this.element=$(element);this.content=content.stripScripts();if(this.adjacency&&this.element.insertAdjacentHTML){try{this.element.insertAdjacentHTML(this.adjacency,this.content);}catch(e){var tagName=this.element.tagName.toLowerCase();if(tagName=='tbody'||tagName=='tr'){this.insertContent(this.contentFromAnonymousTable());}else{throw e;}}}else{this.range=this.element.ownerDocument.createRange();if(this.initializeRange)this.initializeRange();this.insertContent([this.range.createContextualFragment(this.content)]);}
setTimeout(function(){content.evalScripts()},10);},contentFromAnonymousTable:function(){var div=document.createElement('div');div.innerHTML='<table><tbody>'+this.content+'</tbody></table>';return $A(div.childNodes[0].childNodes[0].childNodes);}}
var Insertion=new Object();Insertion.Before=Class.create();Insertion.Before.prototype=Object.extend(new Abstract.Insertion('beforeBegin'),{initializeRange:function(){this.range.setStartBefore(this.element);},insertContent:function(fragments){fragments.each((function(fragment){this.element.parentNode.insertBefore(fragment,this.element);}).bind(this));}});Insertion.Top=Class.create();Insertion.Top.prototype=Object.extend(new Abstract.Insertion('afterBegin'),{initializeRange:function(){this.range.selectNodeContents(this.element);this.range.collapse(true);},insertContent:function(fragments){fragments.reverse(false).each((function(fragment){this.element.insertBefore(fragment,this.element.firstChild);}).bind(this));}});Insertion.Bottom=Class.create();Insertion.Bottom.prototype=Object.extend(new Abstract.Insertion('beforeEnd'),{initializeRange:function(){this.range.selectNodeContents(this.element);this.range.collapse(this.element);},insertContent:function(fragments){fragments.each((function(fragment){this.element.appendChild(fragment);}).bind(this));}});Insertion.After=Class.create();Insertion.After.prototype=Object.extend(new Abstract.Insertion('afterEnd'),{initializeRange:function(){this.range.setStartAfter(this.element);},insertContent:function(fragments){fragments.each((function(fragment){this.element.parentNode.insertBefore(fragment,this.element.nextSibling);}).bind(this));}});Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(element){this.element=$(element);},_each:function(iterator){this.element.className.split(/\s+/).select(function(name){return name.length>0;})._each(iterator);},set:function(className){this.element.className=className;},add:function(classNameToAdd){if(this.include(classNameToAdd))return;this.set(this.toArray().concat(classNameToAdd).join(' '));},remove:function(classNameToRemove){if(!this.include(classNameToRemove))return;this.set(this.select(function(className){return className!=classNameToRemove;}).join(' '));},toString:function(){return this.toArray().join(' ');}}
Object.extend(Element.ClassNames.prototype,Enumerable);var Selector=Class.create();Selector.prototype={initialize:function(expression){this.params={classNames:[]};this.expression=expression.toString().strip();this.parseExpression();this.compileMatcher();},parseExpression:function(){function abort(message){throw'Parse error in selector: '+message;}
if(this.expression=='')abort('empty expression');var params=this.params,expr=this.expression,match,modifier,clause,rest;while(match=expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)){params.attributes=params.attributes||[];params.attributes.push({name:match[2],operator:match[3],value:match[4]||match[5]||''});expr=match[1];}
if(expr=='*')return this.params.wildcard=true;while(match=expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i)){modifier=match[1],clause=match[2],rest=match[3];switch(modifier){case'#':params.id=clause;break;case'.':params.classNames.push(clause);break;case'':case undefined:params.tagName=clause.toUpperCase();break;default:abort(expr.inspect());}
expr=rest;}
if(expr.length>0)abort(expr.inspect());},buildMatchExpression:function(){var params=this.params,conditions=[],clause;if(params.wildcard)
conditions.push('true');if(clause=params.id)
conditions.push('element.id == '+clause.inspect());if(clause=params.tagName)
conditions.push('element.tagName.toUpperCase() == '+clause.inspect());if((clause=params.classNames).length>0)
for(var i=0;i<clause.length;i++)
conditions.push('Element.hasClassName(element, '+clause[i].inspect()+')');if(clause=params.attributes){clause.each(function(attribute){var value='element.getAttribute('+attribute.name.inspect()+')';var splitValueBy=function(delimiter){return value+' && '+value+'.split('+delimiter.inspect()+')';}
switch(attribute.operator){case'=':conditions.push(value+' == '+attribute.value.inspect());break;case'~=':conditions.push(splitValueBy(' ')+'.include('+attribute.value.inspect()+')');break;case'|=':conditions.push(splitValueBy('-')+'.first().toUpperCase() == '+attribute.value.toUpperCase().inspect());break;case'!=':conditions.push(value+' != '+attribute.value.inspect());break;case'':case undefined:conditions.push(value+' != null');break;default:throw'Unknown operator '+attribute.operator+' in selector';}});}
return conditions.join(' && ');},compileMatcher:function(){this.match=new Function('element','if (!element.tagName) return false; \
      return '+this.buildMatchExpression());},findElements:function(scope){var element;if(element=$(this.params.id))
if(this.match(element))
if(!scope||Element.childOf(element,scope))
return[element];scope=(scope||document).getElementsByTagName(this.params.tagName||'*');var results=[];for(var i=0;i<scope.length;i++)
if(this.match(element=scope[i]))
results.push(Element.extend(element));return results;},toString:function(){return this.expression;}}
function $$(){return $A(arguments).map(function(expression){return expression.strip().split(/\s+/).inject([null],function(results,expr){var selector=new Selector(expr);return results.map(selector.findElements.bind(selector)).flatten();});}).flatten();}
var Field={clear:function(){for(var i=0;i<arguments.length;i++)
$(arguments[i]).value='';},focus:function(element){$(element).focus();},present:function(){for(var i=0;i<arguments.length;i++)
if($(arguments[i]).value=='')return false;return true;},select:function(element){$(element).select();},activate:function(element){element=$(element);element.focus();if(element.select)
element.select();}}
var Form={serialize:function(form){var elements=Form.getElements($(form));var queryComponents=new Array();for(var i=0;i<elements.length;i++){var queryComponent=Form.Element.serialize(elements[i]);if(queryComponent)
queryComponents.push(queryComponent);}
return queryComponents.join('&');},getElements:function(form){form=$(form);var elements=new Array();for(var tagName in Form.Element.Serializers){var tagElements=form.getElementsByTagName(tagName);for(var j=0;j<tagElements.length;j++)
elements.push(tagElements[j]);}
return elements;},getInputs:function(form,typeName,name){form=$(form);var inputs=form.getElementsByTagName('input');if(!typeName&&!name)
return inputs;var matchingInputs=new Array();for(var i=0;i<inputs.length;i++){var input=inputs[i];if((typeName&&input.type!=typeName)||(name&&input.name!=name))
continue;matchingInputs.push(input);}
return matchingInputs;},disable:function(form){var elements=Form.getElements(form);for(var i=0;i<elements.length;i++){var element=elements[i];element.blur();element.disabled='true';}},enable:function(form){var elements=Form.getElements(form);for(var i=0;i<elements.length;i++){var element=elements[i];element.disabled='';}},findFirstElement:function(form){return Form.getElements(form).find(function(element){return element.type!='hidden'&&!element.disabled&&['input','select','textarea'].include(element.tagName.toLowerCase());});},focusFirstElement:function(form){Field.activate(Form.findFirstElement(form));},reset:function(form){$(form).reset();}}
Form.Element={serialize:function(element){element=$(element);var method=element.tagName.toLowerCase();var parameter=Form.Element.Serializers[method](element);if(parameter){var key=encodeURIComponent(parameter[0]);if(key.length==0)return;if(parameter[1].constructor!=Array)
parameter[1]=[parameter[1]];return parameter[1].map(function(value){return key+'='+encodeURIComponent(value);}).join('&');}},getValue:function(element){element=$(element);var method=element.tagName.toLowerCase();var parameter=Form.Element.Serializers[method](element);if(parameter)
return parameter[1];}}
Form.Element.Serializers={input:function(element){switch(element.type.toLowerCase()){case'submit':case'hidden':case'password':case'text':return Form.Element.Serializers.textarea(element);case'checkbox':case'radio':return Form.Element.Serializers.inputSelector(element);}
return false;},inputSelector:function(element){if(element.checked)
return[element.name,element.value];},textarea:function(element){return[element.name,element.value];},select:function(element){return Form.Element.Serializers[element.type=='select-one'?'selectOne':'selectMany'](element);},selectOne:function(element){var value='',opt,index=element.selectedIndex;if(index>=0){opt=element.options[index];value=opt.value||opt.text;}
return[element.name,value];},selectMany:function(element){var value=[];for(var i=0;i<element.length;i++){var opt=element.options[i];if(opt.selected)
value.push(opt.value||opt.text);}
return[element.name,value];}}
var $F=Form.Element.getValue;Abstract.TimedObserver=function(){}
Abstract.TimedObserver.prototype={initialize:function(element,frequency,callback){this.frequency=frequency;this.element=$(element);this.callback=callback;this.lastValue=this.getValue();this.registerCallback();},registerCallback:function(){setInterval(this.onTimerEvent.bind(this),this.frequency*1000);},onTimerEvent:function(){var value=this.getValue();if(this.lastValue!=value){this.callback(this.element,value);this.lastValue=value;}}}
Form.Element.Observer=Class.create();Form.Element.Observer.prototype=Object.extend(new Abstract.TimedObserver(),{getValue:function(){return Form.Element.getValue(this.element);}});Form.Observer=Class.create();Form.Observer.prototype=Object.extend(new Abstract.TimedObserver(),{getValue:function(){return Form.serialize(this.element);}});Abstract.EventObserver=function(){}
Abstract.EventObserver.prototype={initialize:function(element,callback){this.element=$(element);this.callback=callback;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=='form')
this.registerFormCallbacks();else
this.registerCallback(this.element);},onElementEvent:function(){var value=this.getValue();if(this.lastValue!=value){this.callback(this.element,value);this.lastValue=value;}},registerFormCallbacks:function(){var elements=Form.getElements(this.element);for(var i=0;i<elements.length;i++)
this.registerCallback(elements[i]);},registerCallback:function(element){if(element.type){switch(element.type.toLowerCase()){case'checkbox':case'radio':Event.observe(element,'click',this.onElementEvent.bind(this));break;case'password':case'text':case'textarea':case'select-one':case'select-multiple':Event.observe(element,'change',this.onElementEvent.bind(this));break;}}}}
Form.Element.EventObserver=Class.create();Form.Element.EventObserver.prototype=Object.extend(new Abstract.EventObserver(),{getValue:function(){return Form.Element.getValue(this.element);}});Form.EventObserver=Class.create();Form.EventObserver.prototype=Object.extend(new Abstract.EventObserver(),{getValue:function(){return Form.serialize(this.element);}});if(!window.Event){var Event=new Object();}
Object.extend(Event,{KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,element:function(event){return event.target||event.srcElement;},isLeftClick:function(event){return(((event.which)&&(event.which==1))||((event.button)&&(event.button==1)));},pointerX:function(event){return event.pageX||(event.clientX+
(document.documentElement.scrollLeft||document.body.scrollLeft));},pointerY:function(event){return event.pageY||(event.clientY+
(document.documentElement.scrollTop||document.body.scrollTop));},stop:function(event){if(event.preventDefault){event.preventDefault();event.stopPropagation();}else{event.returnValue=false;event.cancelBubble=true;}},findElement:function(event,tagName){var element=Event.element(event);while(element.parentNode&&(!element.tagName||(element.tagName.toUpperCase()!=tagName.toUpperCase())))
element=element.parentNode;return element;},observers:false,_observeAndCache:function(element,name,observer,useCapture){if(!this.observers)this.observers=[];if(element.addEventListener){this.observers.push([element,name,observer,useCapture]);element.addEventListener(name,observer,useCapture);}else if(element.attachEvent){this.observers.push([element,name,observer,useCapture]);element.attachEvent('on'+name,observer);}},unloadCache:function(){if(!Event.observers)return;for(var i=0;i<Event.observers.length;i++){Event.stopObserving.apply(this,Event.observers[i]);Event.observers[i][0]=null;}
Event.observers=false;},observe:function(element,name,observer,useCapture){var element=$(element);useCapture=useCapture||false;if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.attachEvent))
name='keydown';this._observeAndCache(element,name,observer,useCapture);},stopObserving:function(element,name,observer,useCapture){var element=$(element);useCapture=useCapture||false;if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.detachEvent))
name='keydown';if(element.removeEventListener){element.removeEventListener(name,observer,useCapture);}else if(element.detachEvent){element.detachEvent('on'+name,observer);}}});if(navigator.appVersion.match(/\bMSIE\b/))
Event.observe(window,'unload',Event.unloadCache,false);var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;},realOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.scrollTop||0;valueL+=element.scrollLeft||0;element=element.parentNode;}while(element);return[valueL,valueT];},cumulativeOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent;}while(element);return[valueL,valueT];},positionedOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent;if(element){p=Element.getStyle(element,'position');if(p=='relative'||p=='absolute')break;}}while(element);return[valueL,valueT];},offsetParent:function(element){if(element.offsetParent)return element.offsetParent;if(element==document.body)return element;while((element=element.parentNode)&&element!=document.body)
if(Element.getStyle(element,'position')!='static')
return element;return document.body;},within:function(element,x,y){if(this.includeScrollOffsets)
return this.withinIncludingScrolloffsets(element,x,y);this.xcomp=x;this.ycomp=y;this.offset=this.cumulativeOffset(element);return(y>=this.offset[1]&&y<this.offset[1]+element.offsetHeight&&x>=this.offset[0]&&x<this.offset[0]+element.offsetWidth);},withinIncludingScrolloffsets:function(element,x,y){var offsetcache=this.realOffset(element);this.xcomp=x+offsetcache[0]-this.deltaX;this.ycomp=y+offsetcache[1]-this.deltaY;this.offset=this.cumulativeOffset(element);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+element.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+element.offsetWidth);},overlap:function(mode,element){if(!mode)return 0;if(mode=='vertical')
return((this.offset[1]+element.offsetHeight)-this.ycomp)/element.offsetHeight;if(mode=='horizontal')
return((this.offset[0]+element.offsetWidth)-this.xcomp)/element.offsetWidth;},clone:function(source,target){source=$(source);target=$(target);target.style.position='absolute';var offsets=this.cumulativeOffset(source);target.style.top=offsets[1]+'px';target.style.left=offsets[0]+'px';target.style.width=source.offsetWidth+'px';target.style.height=source.offsetHeight+'px';},page:function(forElement){var valueT=0,valueL=0;var element=forElement;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;if(element.offsetParent==document.body)
if(Element.getStyle(element,'position')=='absolute')break;}while(element=element.offsetParent);element=forElement;do{valueT-=element.scrollTop||0;valueL-=element.scrollLeft||0;}while(element=element.parentNode);return[valueL,valueT];},clone:function(source,target){var options=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{})
source=$(source);var p=Position.page(source);target=$(target);var delta=[0,0];var parent=null;if(Element.getStyle(target,'position')=='absolute'){parent=Position.offsetParent(target);delta=Position.page(parent);}
if(parent==document.body){delta[0]-=document.body.offsetLeft;delta[1]-=document.body.offsetTop;}
if(options.setLeft)target.style.left=(p[0]-delta[0]+options.offsetLeft)+'px';if(options.setTop)target.style.top=(p[1]-delta[1]+options.offsetTop)+'px';if(options.setWidth)target.style.width=source.offsetWidth+'px';if(options.setHeight)target.style.height=source.offsetHeight+'px';},absolutize:function(element){element=$(element);if(element.style.position=='absolute')return;Position.prepare();var offsets=Position.positionedOffset(element);var top=offsets[1];var left=offsets[0];var width=element.clientWidth;var height=element.clientHeight;element._originalLeft=left-parseFloat(element.style.left||0);element._originalTop=top-parseFloat(element.style.top||0);element._originalWidth=element.style.width;element._originalHeight=element.style.height;element.style.position='absolute';element.style.top=top+'px';;element.style.left=left+'px';;element.style.width=width+'px';;element.style.height=height+'px';;},relativize:function(element){element=$(element);if(element.style.position=='relative')return;Position.prepare();element.style.position='relative';var top=parseFloat(element.style.top||0)-(element._originalTop||0);var left=parseFloat(element.style.left||0)-(element._originalLeft||0);element.style.top=top+'px';element.style.left=left+'px';element.style.height=element._originalHeight;element.style.width=element._originalWidth;}}
if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){Position.cumulativeOffset=function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;if(element.offsetParent==document.body)
if(Element.getStyle(element,'position')=='absolute')break;element=element.offsetParent;}while(element);return[valueL,valueT];}};var forgotID="";function hide_forgot_password()
{setTimeout('hide_forgot()',3000);}
function hide_forgot()
{clear_forgot_feild();Effect.SlideUp('dd1');return false;}
function clear_forgot_feild()
{document.getElementById('forgot_msg').innerHTML="";document.getElementById('vchEmail').value="";}
function checkforgotpass(theForm)
{theControl="vchEmail";theMessage="Email";theNumeric=",";theEmail="Y";theURL=",";theConfirmPassword=",";thebadstuff=",";theinteger=",";thepercent=",";thesize=",";thedecimal=",";theimage=",";theempty="Y";themin=",";themax=",";thecheckboxlength=",";thephoneno=",";if(!theValidator(theForm,theControl,theMessage,theNumeric,theEmail,theURL,theConfirmPassword,thebadstuff,theinteger,thepercent,thesize,thedecimal,theimage,theempty,themin,themax,thecheckboxlength,thephoneno)){return false;}
else{xajax_forgot_password(theForm.vchEmail.value);return false;}}
function getCheckedValue(radioObj){if(!radioObj)
return"";var radioLength=radioObj.length;if(radioLength==undefined)
if(radioObj.checked)
return radioObj.value;else
return"";for(var i=0;i<radioLength;i++){if(radioObj[i].checked){return radioObj[i].value;}}
return"";}
function checkLoginform(theForm)
{var rememberMe="";var len=theForm.elements.length;for(var i=0;i<len;i++)
{if(theForm.elements[i].type=="checkbox")
{if(theForm.elements[i].checked==true&&theForm.elements[i].name=='rember')
{var rememberMe=theForm.elements[i].value;}}}
arr=new Array();arr["theControl"]="vchChkEmail,vchChkPassword";arr["theMessage"]="Username/Email address,password";arr["theempty"]="Y,Y";arr["theEmail"]="Y,";arr["themin"]=",Y";if(!validateForm(theForm,arr,2))
{return false;}
else
{return true;}}
function myAccount_Page()
{window.location.href=hostURL+"my-account.php";}
function chkCard(theForm)
{arr=new Array();arr["theControl"]="CardNumber,ExpMon,ExpYear,CardType,vchCCSecurityCode,vchCardHolderName";arr["theMessage"]="Card Number,Expirty month,expiry Year,Card type,Security code,Name";arr["theConfirmPassword"]=",,,,,";arr["theempty"]="Y,Y,Y,Y,Y,Y";arr["theEmail"]=",,,,,";if(!validateForm(theForm,arr,6))
return false;if(!validCCForm(theForm.CardType,theForm.CardNumber))
{return false;}
return true;}
function checkCardExpiry()
{var result=true;iMonth=document.frmCard.ExpMon.options[document.frmCard.ExpMon.selectedIndex].value;iYear=document.frmCard.ExpYear.options[document.frmCard.ExpYear.selectedIndex].value;iMonth=parseInt(iMonth)
iYear=parseInt(iYear)
var now=new Date();var nowMonth=now.getMonth()+1;var nowYear=now.getFullYear();expired=(nowYear>iYear)||((nowYear==iYear)&&(nowMonth>iMonth));if(expired)
{result=false;alert("The date for Credit Card has expired.");document.frmCard.ExpMon.focus();}
return result;}
function isValidCreditCardNumber(formField,ccType,fieldLabel,required)
{var result=true;var ccNum=formField.value;if(result&&(formField.value.length>0))
{if(result)
{if(!LuhnCheck(ccNum)||!validateCCNum(ccType,ccNum))
{alert('Please enter a valid card number for the "'+fieldLabel+'" field.');formField.focus();result=false;}}}return result;}
function LuhnCheck(str)
{var result=true;var sum=0;var mul=1;var strLen=str.length;for(i=0;i<strLen;i++)
{var digit=str.substring(strLen-i-1,strLen-i);var tproduct=parseInt(digit,10)*mul;if(tproduct>=10)
sum+=(tproduct%10)+1;else
sum+=tproduct;if(mul==1)
mul++;else
mul--;}
if((sum%10)!=0)
result=false;return result;}
function validateCCNum(cardType,cardNum)
{var result=false;var cardLen=cardNum.length;var firstdig=cardNum.substring(0,1);var seconddig=cardNum.substring(1,2);var first4digs=cardNum.substring(0,4);switch(cardType)
{case"VisaCard":result=((cardLen==16)||(cardLen==13))&&(firstdig=="4");break;case"AmExCard":var validNums="47";result=(cardLen==15)&&(firstdig=="3")&&(validNums.indexOf(seconddig)>=0);break;case"MasterCard":var validNums="12345";result=(cardLen==16)&&(firstdig=="5")&&(validNums.indexOf(seconddig)>=0);break;case"DiscoverCard":result=(cardLen==16)&&(first4digs=="6011");break;case"DinersClubCard":var validNums="068";result=(cardLen==14)&&(firstdig=="3")&&(validNums.indexOf(seconddig)>=0);break;}
return result;}
function isValidccCardCode(formField,fieldLabel)
{var result=true;var ccCardCode=formField.value;if(result)
{if(formField.value.length<3)
{alert('Please enter 3 digit number for the "'+fieldLabel+'" field.');formField.focus();result=false;}}
return result;}
function validCCForm(ccTypeField,ccNumField)
{theform=document.frmCard;var result=isValidCreditCardNumber(ccNumField,ccTypeField.value,"Credit Card Number")&&checkCardExpiry()&&isValidccCardCode(theform.vchCCSecurityCode,"ID Verfication");return result}
function getValue(thisForm)
{var len=document.frmViewCard.elements.length;var ccID="";for(var i=0;i<len;i++)
{if(document.frmViewCard.elements[i].type=="radio")
{if(document.frmViewCard.elements[i].checked==true&&document.frmViewCard.elements[i].name=='default')
{var ccID=document.frmViewCard.elements[i].value;}}}
xajax_update_defaultCC(ccID);}
function showArticle()
{var categoryID;categoryID=document.getElementById('category').value;window.location="my-articles.php?categoryID="+categoryID;}
function DeletemyArticle(div_id,articleid)
{var msg;msg=confirm('Are you want to remove this article');if(msg)
{new Ajax.Updater(div_id,'articles.php?articleid='+articleid,{asynchronous:true,evalScripts:true});}}
function showmsg(id)
{if(confirm('Are you want to remove this article?'))
xajax_deleteArticle(id);}
function chkFormEmail(theForm)
{arr=new Array();arr["theControl"]="vchEmail";arr["theMessage"]="Email ID";arr["theempty"]="Y";arr["theEmail"]="Y";arr["thebadstuff"]="";if(!validateForm(theForm,arr,1))
return false;else
{xajax_changeUserID(theForm.vchEmail.value);return false;}}
function show_changeEmail(email)
{setTimeout('change_Email("'+email+'")',2000);}
function change_Email(email)
{xajax_edit_email_generate(email,"1");}
function logout_user()
{setTimeout('logout()',5000);}
function logout()
{window.location.href="logout.php";}
function submitFrmServiceOption(theForm)
{theForm.submit();}
function validateCoupon(theForm){if(theForm.vchCouponCode.value!=""){return xajax_validateCouponCode(theForm.vchCouponCode.value,theForm.dblPaymentAmount1.value,theForm.dblTotalPaymentAmount1.value,theForm.intServiceOptionID1.value,theForm.applyCoupon1.value,theForm.intTrialPeriod.value,theForm.dblFirstPaidAmount.value);}else{alert("Please enter valid coupon code.");return false;}}
function validateCoupon1(theForm){if(theForm.vchCouponCode1.value!=""){return xajax_validateCouponCode1(theForm.vchCouponCode1.value,theForm.dblPaymentAmount1.value,theForm.dblTotalPaymentAmount1.value,theForm.intServiceOptionID1.value,theForm.applyCoupon2.value,theForm.intTrialPeriod.value,theForm.dblFirstPaidAmount.value);}else{alert("Please enter valid coupon code.");return false;}}
function addToCart(){document.frmCart.dblPaymentAmount.value=document.frmServiceOptions1.dblPaymentAmount1.value;document.frmCart.dblTotalPaymentAmount.value=document.frmServiceOptions1.dblTotalPaymentAmount1.value;document.frmCart.dblCoupon1Discount.value=document.frmServiceOptions1.dblCoupon1Discount.value;document.frmCart.dblCoupon2Discount.value=document.frmServiceOptions1.dblCoupon2Discount.value;document.frmCart.basePrice.value=document.frmServiceOptions1.basePrice.value;document.frmCart.intServiceID.value=document.frmServiceOptions1.intServiceID1.value;document.frmCart.intServiceOptionID.value=document.frmServiceOptions1.intServiceOptionID1.value;document.frmCart.referralPromotion.value=getCheckedValue(document.frmServiceOptions1.referralPromotion);document.frmCart.submit();}
function deleteFromCart(orderID,cartID)
{if(confirm("Are you sure you want to remove this from cart?"))
xajax_deleteFromCart(orderID,cartID);}
function clearCart(orderID)
{if(confirm("Are you sure you want to clear the cart?"))
xajax_clearCart(orderID);}
function deleteReferralProgram(orderID,cartID)
{if(confirm("Are you sure you want to remove this reffral program?"))
xajax_deleteReferralProgram(orderID,cartID);}
function popup_seal(url,windowname)
{var popupWidth=550;var popupHeight=450;var left=(screen.width-popupWidth)/2;var top=(screen.height-popupHeight)/2;window.open(url,windowname,'width='+popupWidth+',height='+popupHeight+',scrollbars=yes,left='+left+',top='+top+', menubar=yes');return false;};function myRight(str,n){if(n<=0)
return"";else if(n>String(str).length)
return str;else{var iLen=String(str).length;return String(str).substring(iLen,iLen-n);}}
function myChangeStatus(theForm,id)
{var stat=document.getElementById('enumStatus'+id).value;if(stat=='A')
{rtn=confirm("Are you sure you want to deactivate this record?");}
else if(stat=='D')
{rtn=confirm("Are you sure you want to activate this record?");}
if(rtn)
{var status=eval('theForm.enumStatus'+id).value;xajax_update_status(id,status);}}
function myChangeStatus_discount(theForm,id,discType)
{var stat=document.getElementById('enumStatus'+discType+id).value;if(stat=='A')
{rtn=confirm("Are you sure you want to deactivate this record?");}
else if(stat=='D')
{rtn=confirm("Are you sure you want to activate this record?");}
if(rtn)
{var status=eval('theForm.enumStatus'+discType+id).value;xajax_update_status_discount(id,status,discType);}}
function sendNewsLetter(id)
{if(confirm('Are you sure you want to send this newsletter?'))
xajax_sendnewsletter(id);}
function delete_row(cardid,defCheck,totalCards)
{if(totalCards==1)
{if(defCheck=='Yes')
{if(confirm('Are you sure you want to delete the credit card, you would need to \n re-enter the credit card details for future purchase?'))
xajax_deleteRow(cardid);}}
else if(totalCards>1)
{if(defCheck=='Yes')
{alert('You are deleting your default credit card, please select your next default \n credit card for future transactions.');}
else
{if(confirm('Are you sure you want to delete the credit card?'))
xajax_deleteRow(cardid);}}}
function delete_all_row(ids)
{xajax_deleteAllRow(ids);}
Array.prototype.exists=function(x){for(var i=0;i<this.length;i++){if(this[i].value==x)return true;}
return false;}
function clear_cal_date(field_id)
{document.getElementById(field_id).value="";document.getElementById('disp_cal_'+field_id).innerHTML='&nbsp;&nbsp;';}
function byteCounter(field,countfield,maxlimit,setDiv){if(field.value.length>maxlimit)
{field.value=field.value.substring(0,maxlimit);document.getElementById(setDiv).innerHTML=field.value.length+"/"+maxlimit;}
else
{countfield.value=maxlimit-field.value.length;document.getElementById(setDiv).innerHTML=field.value.length+"/"+maxlimit;}}
function get_element_text(element_id)
{var text="";var elem=document.getElementById(element_id);if(elem.textContent){text=trim(elem.textContent);}else if(elem.innerText){text=trim(elem.innerText);}
return text;}
function MM_openBrWindow(theURL,winName,features)
{window.open(theURL,winName,features);}
function MM_preloadImages(){var d=document;if(d.images){if(!d.MM_p)d.MM_p=new Array();var i,j=d.MM_p.length,a=MM_preloadImages.arguments;for(i=0;i<a.length;i++)
if(a[i].indexOf("#")!=0){d.MM_p[j]=new Image;d.MM_p[j++].src=a[i];}}}
function MM_findObj(n,d){var p,i,x;if(!d)d=document;if((p=n.indexOf("?"))>0&&parent.frames.length){d=parent.frames[n.substring(p+1)].document;n=n.substring(0,p);}
if(!(x=d[n])&&d.all)x=d.all[n];for(i=0;!x&&i<d.forms.length;i++)x=d.forms[i][n];for(i=0;!x&&d.layers&&i<d.layers.length;i++)x=MM_findObj(n,d.layers[i].document);if(!x&&d.getElementById)x=d.getElementById(n);return x;}
function MM_swapImage(){var i,j=0,x,a=MM_swapImage.arguments;document.MM_sr=new Array;for(i=0;i<(a.length-2);i+=3)
if((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x;if(!x.oSrc)x.oSrc=x.src;x.src=a[i+2];}}
function MM_swapImgRestore(){var i,x,a=document.MM_sr;for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)x.src=x.oSrc;}
function swap_text(txtCaption){if(window.document.getElementById)
{window.document.getElementById("txtCaption").innerHTML=txtCaption;}
if(window.document.layers)
{window.document.layers["txtCaption"].innerHTML=txtCaption;}
if(window.document.all)
{window.document.all["txtCaption"].innerHTML=txtCaption;}}
function isDefined(variable,type_evt)
{try
{if(type_evt==1)
{if(variable==null)
{return false;}
if("undefined"==typeof(variable))
{return false;}
return true;}
else
return(typeof(window[variable])=="undefined")?false:true;}
catch(e)
{}}
function strRepeat(cnt)
{var retStr="";for(i=0;i<cnt;i++)
retStr=retStr+",";return retStr;}
function validateForm(myForm,cArray,cnt)
{var i=0;var values="theControl,theMessage,theNumeric,theEmail,theURL,theConfirmPassword,thebadstuff,theinteger,thepercent,thesize,thedecimal,theimage,theempty,themin,themax,thecheckboxlength,thephoneno";var leftSide=new Array();var rightVals=new Array();leftSide=values.split(",");var strRepeats=strRepeat(cnt-1);for(i=0;i<leftSide.length;i++){if(cArray[leftSide[i]]){rightVals[i]=(cArray[leftSide[i]]);}else{rightVals[i]=strRepeats;}
leftSide[i]=rightVals[i];}
if(!theValidator(myForm,leftSide[0],leftSide[1],leftSide[2],leftSide[3],leftSide[4],leftSide[5],leftSide[6],leftSide[7],leftSide[8],leftSide[9],leftSide[10],leftSide[11],leftSide[12],leftSide[13],leftSide[14],leftSide[15],leftSide[16]))
return false;return true;}
function validate_FckEditor(instanceName)
{var oEditor=FCKeditorAPI.GetInstance(instanceName);var str=oEditor.EditorDocument.body.innerHTML;str=str.replace("&nbsp;","");str=str.replace("<BR>","");str=str.replace("<BR/>","");str=str.replace("<P>","");str=str.replace("</P>","");str=str.replace("<br>","");str=str.replace("<br/>","");str=str.replace("<p>","");str=str.replace("</p>","");if(str=="")
return false;else
return true;}
function addRowToTable(theForm)
{var tbl=document.getElementById('tblDynamic');var lastRow=tbl.rows.length;if(lastRow<=5)
{if(document.getElementById('no-child'))
{var ind=document.getElementById('no-child').rowIndex;tbl.deleteRow(ind);lastRow=tbl.rows.length;}
theForm.tempCounter.value=parseInt(theForm.tempCounter.value,10)+1;var td0=theForm.mm.value+'/'+theForm.dd.value+'/'+theForm.yy.value;var dob=theForm.yy.value+'-'+theForm.mm.value+'-'+theForm.dd.value;if(theForm.enumGender[0].checked){var td1='Boy';}
else{var td1='Girl';}
var td2=document.createElement('img');td2.setAttribute('src','images/delete-new.gif');td2.setAttribute('title','Delete');td2.setAttribute('alt','Delete');td2.setAttribute('border','0');var hidChild=document.createElement('input');hidChild.setAttribute('type','hidden');hidChild.setAttribute('name','child[]');if(td1=='Boy')hidChild.setAttribute('value','B'+','+dob);else hidChild.setAttribute('value','G'+','+dob);var row=tbl.insertRow(lastRow);row.setAttribute('id','child-'+theForm.tempCounter.value);td2.onclick=function(){delRowTable(row)}
var cell0=row.insertCell(0);var textNode0=document.createTextNode(td0);cell0.appendChild(textNode0);cell0.appendChild(hidChild);var cell1=row.insertCell(1);var textNode1=document.createTextNode(td1);cell1.appendChild(textNode1);var cell2=row.insertCell(2);cell2.appendChild(td2);}
else
alert('Maximum limit is 5.');}
function delRowTable(tr)
{if(document.getElementById('child-'+tr))
{var tbl=document.getElementById('tblDynamic');var ind=document.getElementById('child-'+tr).rowIndex;tbl.deleteRow(ind);}
else
{tr.parentNode.removeChild(tr);}}
function addRowToTable_associate(theForm)
{var tbl=document.getElementById('tblDynamic');var lastRow=tbl.rows.length;theForm.tempCounter.value=parseInt(theForm.tempCounter.value)+1;if(theForm.cat_level2.value!="")
{var x=theForm.cat_level1;var y=theForm.cat_level2;var cat_id=theForm.cat_level2.value;var parent_id=theForm.cat_level1.value;}
else
{if(theForm.cat_level2.length>=0)
{alert('Please select Sub-Category.');theForm.cat_level2.focus();return false;}
var x=theForm.cat_level1;var y=theForm.cat_level2;var cat_id=theForm.cat_level2.value;var parent_id=theForm.cat_level1.value;}
cats=Form.getInputs(theForm,'hidden','cats[]');var my_cats=$A(cats);var is_exists;is_exists=(my_cats.exists(cat_id));if(!is_exists)
{var parent_name=x.options[x.selectedIndex].text;var cat_name=y.options[y.selectedIndex].text;var td0=''+parent_name;var td1=''+cat_name;var td2=document.createElement('img');td2.setAttribute('src','images/delete1.gif');td2.setAttribute('title','Delete');td2.setAttribute('alt','Delete');td2.setAttribute('border','0');td2.setAttribute('class','setcursor');var hidCat=document.createElement('input');hidCat.setAttribute('type','hidden');hidCat.setAttribute('name','cats[]');hidCat.setAttribute('value',cat_id);var row=tbl.insertRow(lastRow);row.setAttribute('id','cat-'+theForm.tempCounter.value);td2.onclick=function(){delRowTable_associate(row)}
var cell0=row.insertCell(0);var textNode0=document.createTextNode(td0);cell0.style.width='45%';cell0.valign='middle';cell0.appendChild(textNode0);cell0.appendChild(hidCat);var cell1=row.insertCell(1);var textNode1=document.createTextNode(td1);cell1.style.width='45%';cell1.align='center';cell1.valign='middle';cell1.appendChild(textNode1);var cell2=row.insertCell(2);cell2.style.width='10%';cell2.valign='middle';cell2.align='right';cell2.style.padding='8px';cell2.appendChild(td2);}
else
{alert('This category already exists.');}
return true;}
function delRowTable_associate(tr)
{if(confirm('Are you sure you want to delete this record?'))
{if(document.getElementById('cat-'+tr))
{var tbl=document.getElementById('tblDynamic');var ind=document.getElementById('cat-'+tr).rowIndex;tbl.deleteRow(ind);}
else
{tr.parentNode.removeChild(tr);}}
return false;}
function enableIDs(IDs)
{var IDs=IDs.split(',');for(i=0;i<IDs.length;i++)
{e=document.getElementById(IDs[i]);e.disabled="";}}
function disableIDs(IDs)
{var IDs=IDs.split(',');for(i=0;i<IDs.length;i++)
{e=document.getElementById(IDs[i]);e.disabled="true";}}
function showHiddenIDs(IDs)
{var IDs=IDs.split(',');for(i=0;i<IDs.length;i++)
{new Effect.Appear(IDs[i],{duration:0.0,from:0.1,to:1.0});}}
function hideIDs(IDs)
{var IDs=IDs.split(',');for(i=0;i<IDs.length;i++)
{new Effect.Fade(IDs[i],{duration:0.0});}}
function check_mandatory(theForm)
{id=self.setInterval("show_mandatory(document.getElementById('"+theForm+"'))",200);}
function show_mandatory(theForm)
{if(theForm.cat_level2.length>1)
{showHiddenIDs("sub-cat");enableIDs("cat_level2");}}
function my_check_mandatory(theForm)
{id=self.setInterval("my_show_mandatory(document.getElementById('"+theForm+"'))",200);}
function my_show_mandatory(theForm)
{if(theForm.cat_level2.length>1)
enableIDs("cat_level2");if(theForm.cat_level3.length>1)
enableIDs("cat_level2,cat_level3");}
function PrintThisContent(prn_url)
{var sOption="toolbar=no,location=no,directories=no,menubar=no,";sOption+="scrollbars=yes,width=640,height=480,left=0,top=0";MM_openBrWindow(prn_url,'print_profile_window',sOption);}
function PrintThisContent_js()
{var sWinHTML;sWinHTML=document.getElementById("print_profile_type").innerHTML;sWinHTML+=document.getElementById("print_innerfull").innerHTML;var class_file="print_style";var addl_path="";var popup_content='<html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>:: ClickSize ::</title><link href="css/'+class_file+'.css" rel="stylesheet" type="text/css"></head><body><table width="500"  border="0" cellspacing="0" cellpadding="0" align="center"><tr><td><img src="images/clr.gif" width="1" height="1" alt=""></td></tr><tr><td id="welcom-bg"><img src="images/clr.gif" width="1" height="2" alt=""></td></tr><tr><td style="padding:15px;"><!--img src="'+addl_path+'images/logo1.gif" title="ClickSize"--></td></tr><tr><td bgcolor="#FFFFFF"><table width="100%" border="0" align="center" cellpadding="2" cellspacing="1"><tr><td>'+sWinHTML+'</td></tr><tr class="trbglc"><td align="center"><img src="images/clr.gif" alt="" width="1" height="1"></td></tr></table></td></tr></table><table width="580" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td height="24" align="center" class="bottom-link-bg">Copyright &copy; 2007, clicksize.com. All Rights Reserved.</td></tr></table></body></html>';var sOption="toolbar=yes,location=no,directories=yes,menubar=yes,";sOption+="scrollbars=yes,width=1024,height=768,left=0,top=0";var winprint=window.open("","",sOption);winprint.document.open();winprint.document.write(popup_content);winprint.print();winprint.document.close();winprint.focus();}
function checkDecimals(fieldName,fieldValue)
{decallowed=2;if(isNaN(fieldValue)||fieldValue=="")
{alert("Not a valid number.");fieldName.select();fieldName.focus();}
else
{if(fieldValue.indexOf('.')==-1)fieldValue+=".";dectext=fieldValue.substring(fieldValue.indexOf('.')+1,fieldValue.length);if(dectext.length>decallowed)
{alert("Enter a number with up to "+decallowed+" decimal places.");fieldName.select();fieldName.focus();}}}
function check_all(ccount,ccheck)
{if(document.getElementById('checkStatus').value=="")
{document.getElementById('checkStatus').value="Check";for(i=1;i<document.getElementById(''+ccount+'').value;i++)
{document.getElementById(''+ccheck+'_'+i).checked=true;}}
else
{document.getElementById('checkStatus').value="";for(i=1;i<document.getElementById(''+ccount+'').value;i++)
{document.getElementById(''+ccheck+'_'+i).checked=false;}}}
function chkOptions_all(act,theForm,ccheckbox,ccount)
{if(chkOptions(theForm,ccheckbox))
{if(act=='A')
{if(confirm('Are you sure you want to activate these records?'));else
return false;}
else if(act=='D')
{if(confirm('Are you sure you want to deactivate these records?'));else
return false;}
else if(act=='Delete')
{if(confirm('Are you sure you want to delete these records?'));else
return false;}
var strChkId='';delChkID='';var i;for(i=0;i<theForm.elements.length;i++)
{if(theForm.elements[i].name==''+ccheckbox+'[]'&&theForm.elements[i].checked)
{var strChkId=theForm.elements[i].value;if(act=='A')
{xajax_update_status(strChkId,'D');}
else if(act=='D')
{xajax_update_status(strChkId,'A');}
if(delChkID=="")
{var delChkID=theForm.elements[i].value;}
else
delChkID=delChkID+","+theForm.elements[i].value;}}
for(i=1;i<document.getElementById(''+ccount+'').value;i++)
{document.getElementById(''+ccheckbox+'_'+i).checked=false;}
document.getElementById('checkStatus').value="";if(act=='Delete')
{xajax_deleteRow(delChkID);}}
else
{return false;}}
function chkOptions(theForm,ccheckbox)
{var resVal='';for(i=0;i<theForm.elements.length;i++)
{if(theForm.elements[i].name==''+ccheckbox+'[]'&&theForm.elements[i].checked)
{if(resVal=="")
var resVal=theForm.elements[i].value;else
resVal=resVal+","+theForm.elements[i].value;}}
if(resVal=='')
{alert('Please select a record.');return false;}
else
{return true;}}
function call_page_after_delete(pagid,pageurl)
{sk_ajax_request(pageurl,'&page='+pagid+'&pagin=1','txtResult');}
function fnCopyBillToShip(chkObject,theForm)
{var arrayCount=0;var formField;formFieldShippingArray=new Array("vchShippingFName","vchShippingMName","vchShippingLName","vchShippingStreetName","vchShippingAptNumber","vchShippingCity","intShippingCountry","vchShippingState","vchShippingOtherState","vchShippingZipcode");formFieldBillingArray=new Array("vchFName","vchMName","vchLName","vchStreetName","vchAptNumber","vchCity","intCountryID","vchStateName","Otherstatename","vchZipCode");if(formFieldBillingArray.length>0)
{for(arrayCount=0;arrayCount<formFieldBillingArray.length;arrayCount++)
{if(chkObject.checked==true)
{if(theForm.elements[(formFieldBillingArray[arrayCount])].name=='vchStateName')
{var billingStateID=theForm.elements[(formFieldBillingArray[arrayCount])].value;display_shipping_state(countryID,billingStateID);}
if(theForm.elements[(formFieldBillingArray[arrayCount])].name=='intCountryID'&&theForm.elements[(formFieldBillingArray[arrayCount])].value=='230')
{var countryID=theForm.elements[(formFieldBillingArray[arrayCount])].value;}
else if(theForm.elements[(formFieldBillingArray[arrayCount])].name=='intCountryID'&&theForm.elements[(formFieldBillingArray[arrayCount])].value!='230')
{display_shipping_state(theForm.elements[(formFieldBillingArray[arrayCount])].value,'');}
theForm.elements[(formFieldShippingArray[arrayCount])].value=theForm.elements[(formFieldBillingArray[arrayCount])].value;}
else
{theForm.elements[(formFieldShippingArray[arrayCount])].readOnly=false;theForm.vchShippingState.disabled=false;theForm.vchShippingOtherState.disabled=false;theForm.intShippingCountry.disabled=false;}}}}
function fnCopyMailingToBusiness(chkObject,theForm)
{var arrayCount=0;var formField;formFieldShippingArray=new Array("vchBusinessStreetName","vchBusinessAptNumber","vchBusinessCity","intBusinessCountry","vchBusinessState","vchBusinessOtherState","vchBusinessZipcode");formFieldBillingArray=new Array("vchStreetName","vchAptNumber","vchCity","intCountryID","vchStateName","Otherstatename","vchZipCode");if(formFieldBillingArray.length>0)
{for(arrayCount=0;arrayCount<formFieldBillingArray.length;arrayCount++)
{if(chkObject.checked==true)
{if(theForm.elements[(formFieldBillingArray[arrayCount])].name=='vchStateName')
{var billingStateID=theForm.elements[(formFieldBillingArray[arrayCount])].value;display_business_state(countryID,billingStateID);}
if(theForm.elements[(formFieldBillingArray[arrayCount])].name=='intCountryID'&&theForm.elements[(formFieldBillingArray[arrayCount])].value=='230')
{var countryID=theForm.elements[(formFieldBillingArray[arrayCount])].value;}
else if(theForm.elements[(formFieldBillingArray[arrayCount])].name=='intCountryID'&&theForm.elements[(formFieldBillingArray[arrayCount])].value!='230')
{display_business_state(theForm.elements[(formFieldBillingArray[arrayCount])].value,'');}
theForm.elements[(formFieldShippingArray[arrayCount])].value=theForm.elements[(formFieldBillingArray[arrayCount])].value;}
else
{theForm.elements[(formFieldShippingArray[arrayCount])].readOnly=false;theForm.vchBusinessState.disabled=false;theForm.vchBusinessOtherState.disabled=false;theForm.intBusinessCountry.disabled=false;}}}}
function checkFormQuantity(theForm)
{var len=theForm.elements.length;for(var i=0;i<len;i++)
{if(document.getElementById('intqantity_'+i).value=="")
{alert("Please enter a value for quantity")
document.getElementById('intqantity_'+i).focus();return false;}
if(document.getElementById('intqantity_'+i).value<1)
{alert("Please enter a value greater than 0 for the quantity.")
document.getElementById('intqantity_'+i).focus();return false;}
else
{if(isNaN(document.getElementById('intqantity_'+i).value))
{alert("Please enter a numeric value for the quantity.");document.getElementById('intqantity_'+i).focus();return false;}}}};String.prototype.parseColor=function(){var color='#';if(this.slice(0,4)=='rgb('){var cols=this.slice(4,this.length-1).split(',');var i=0;do{color+=parseInt(cols[i]).toColorPart()}while(++i<3);}else{if(this.slice(0,1)=='#'){if(this.length==4)for(var i=1;i<4;i++)color+=(this.charAt(i)+this.charAt(i)).toLowerCase();if(this.length==7)color=this.toLowerCase();}}
return(color.length==7?color:(arguments[0]||this));}
Element.collectTextNodes=function(element){return $A($(element).childNodes).collect(function(node){return(node.nodeType==3?node.nodeValue:(node.hasChildNodes()?Element.collectTextNodes(node):''));}).flatten().join('');}
Element.collectTextNodesIgnoreClass=function(element,className){return $A($(element).childNodes).collect(function(node){return(node.nodeType==3?node.nodeValue:((node.hasChildNodes()&&!Element.hasClassName(node,className))?Element.collectTextNodesIgnoreClass(node,className):''));}).flatten().join('');}
Element.setContentZoom=function(element,percent){element=$(element);Element.setStyle(element,{fontSize:(percent/100)+'em'});if(navigator.appVersion.indexOf('AppleWebKit')>0)window.scrollBy(0,0);}
Element.getOpacity=function(element){var opacity;if(opacity=Element.getStyle(element,'opacity'))
return parseFloat(opacity);if(opacity=(Element.getStyle(element,'filter')||'').match(/alpha\(opacity=(.*)\)/))
if(opacity[1])return parseFloat(opacity[1])/100;return 1.0;}
Element.setOpacity=function(element,value){element=$(element);if(value==1){Element.setStyle(element,{opacity:(/Gecko/.test(navigator.userAgent)&&!/Konqueror|Safari|KHTML/.test(navigator.userAgent))?0.999999:null});if(/MSIE/.test(navigator.userAgent))
Element.setStyle(element,{filter:Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'')});}else{if(value<0.00001)value=0;Element.setStyle(element,{opacity:value});if(/MSIE/.test(navigator.userAgent))
Element.setStyle(element,{filter:Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'')+'alpha(opacity='+value*100+')'});}}
Element.getInlineOpacity=function(element){return $(element).style.opacity||'';}
Element.childrenWithClassName=function(element,className,findFirst){var classNameRegExp=new RegExp("(^|\\s)"+className+"(\\s|$)");var results=$A($(element).getElementsByTagName('*'))[findFirst?'detect':'select'](function(c){return(c.className&&c.className.match(classNameRegExp));});if(!results)results=[];return results;}
Element.forceRerendering=function(element){try{element=$(element);var n=document.createTextNode(' ');element.appendChild(n);element.removeChild(n);}catch(e){}};Array.prototype.call=function(){var args=arguments;this.each(function(f){f.apply(this,args)});}
var Effect={tagifyText:function(element){var tagifyStyle='position:relative';if(/MSIE/.test(navigator.userAgent))tagifyStyle+=';zoom:1';element=$(element);$A(element.childNodes).each(function(child){if(child.nodeType==3){child.nodeValue.toArray().each(function(character){element.insertBefore(Builder.node('span',{style:tagifyStyle},character==' '?String.fromCharCode(160):character),child);});Element.remove(child);}});},multiple:function(element,effect){var elements;if(((typeof element=='object')||(typeof element=='function'))&&(element.length))
elements=element;else
elements=$(element).childNodes;var options=Object.extend({speed:0.1,delay:0.0},arguments[2]||{});var masterDelay=options.delay;$A(elements).each(function(element,index){new effect(element,Object.extend(options,{delay:index*options.speed+masterDelay}));});},PAIRS:{'slide':['SlideDown','SlideUp'],'blind':['BlindDown','BlindUp'],'appear':['Appear','Fade']},toggle:function(element,effect){element=$(element);effect=(effect||'appear').toLowerCase();var options=Object.extend({queue:{position:'end',scope:(element.id||'global'),limit:1}},arguments[2]||{});Effect[element.visible()?Effect.PAIRS[effect][1]:Effect.PAIRS[effect][0]](element,options);}};var Effect2=Effect;Effect.Transitions={}
Effect.Transitions.linear=function(pos){return pos;}
Effect.Transitions.sinoidal=function(pos){return(-Math.cos(pos*Math.PI)/2)+0.5;}
Effect.Transitions.reverse=function(pos){return 1-pos;}
Effect.Transitions.flicker=function(pos){return((-Math.cos(pos*Math.PI)/4)+0.75)+Math.random()/4;}
Effect.Transitions.wobble=function(pos){return(-Math.cos(pos*Math.PI*(9*pos))/2)+0.5;}
Effect.Transitions.pulse=function(pos){return(Math.floor(pos*10)%2==0?(pos*10-Math.floor(pos*10)):1-(pos*10-Math.floor(pos*10)));}
Effect.Transitions.none=function(pos){return 0;}
Effect.Transitions.full=function(pos){return 1;}
Effect.ScopedQueue=Class.create();Object.extend(Object.extend(Effect.ScopedQueue.prototype,Enumerable),{initialize:function(){this.effects=[];this.interval=null;},_each:function(iterator){this.effects._each(iterator);},add:function(effect){var timestamp=new Date().getTime();var position=(typeof effect.options.queue=='string')?effect.options.queue:effect.options.queue.position;switch(position){case'front':this.effects.findAll(function(e){return e.state=='idle'}).each(function(e){e.startOn+=effect.finishOn;e.finishOn+=effect.finishOn;});break;case'end':timestamp=this.effects.pluck('finishOn').max()||timestamp;break;}
effect.startOn+=timestamp;effect.finishOn+=timestamp;if(!effect.options.queue.limit||(this.effects.length<effect.options.queue.limit))
this.effects.push(effect);if(!this.interval)
this.interval=setInterval(this.loop.bind(this),40);},remove:function(effect){this.effects=this.effects.reject(function(e){return e==effect});if(this.effects.length==0){clearInterval(this.interval);this.interval=null;}},loop:function(){var timePos=new Date().getTime();this.effects.invoke('loop',timePos);}});Effect.Queues={instances:$H(),get:function(queueName){if(typeof queueName!='string')return queueName;if(!this.instances[queueName])
this.instances[queueName]=new Effect.ScopedQueue();return this.instances[queueName];}}
Effect.Queue=Effect.Queues.get('global');Effect.DefaultOptions={transition:Effect.Transitions.sinoidal,duration:1.0,fps:25.0,sync:false,from:0.0,to:1.0,delay:0.0,queue:'parallel'}
Effect.Base=function(){};Effect.Base.prototype={position:null,start:function(options){this.options=Object.extend(Object.extend({},Effect.DefaultOptions),options||{});this.currentFrame=0;this.state='idle';this.startOn=this.options.delay*1000;this.finishOn=this.startOn+(this.options.duration*1000);this.event('beforeStart');if(!this.options.sync)
Effect.Queues.get(typeof this.options.queue=='string'?'global':this.options.queue.scope).add(this);},loop:function(timePos){if(timePos>=this.startOn){if(timePos>=this.finishOn){this.render(1.0);this.cancel();this.event('beforeFinish');if(this.finish)this.finish();this.event('afterFinish');return;}
var pos=(timePos-this.startOn)/(this.finishOn-this.startOn);var frame=Math.round(pos*this.options.fps*this.options.duration);if(frame>this.currentFrame){this.render(pos);this.currentFrame=frame;}}},render:function(pos){if(this.state=='idle'){this.state='running';this.event('beforeSetup');if(this.setup)this.setup();this.event('afterSetup');}
if(this.state=='running'){if(this.options.transition)pos=this.options.transition(pos);pos*=(this.options.to-this.options.from);pos+=this.options.from;this.position=pos;this.event('beforeUpdate');if(this.update)this.update(pos);this.event('afterUpdate');}},cancel:function(){if(!this.options.sync)
Effect.Queues.get(typeof this.options.queue=='string'?'global':this.options.queue.scope).remove(this);this.state='finished';},event:function(eventName){if(this.options[eventName+'Internal'])this.options[eventName+'Internal'](this);if(this.options[eventName])this.options[eventName](this);},inspect:function(){return'#<Effect:'+$H(this).inspect()+',options:'+$H(this.options).inspect()+'>';}}
Effect.Parallel=Class.create();Object.extend(Object.extend(Effect.Parallel.prototype,Effect.Base.prototype),{initialize:function(effects){this.effects=effects||[];this.start(arguments[1]);},update:function(position){this.effects.invoke('render',position);},finish:function(position){this.effects.each(function(effect){effect.render(1.0);effect.cancel();effect.event('beforeFinish');if(effect.finish)effect.finish(position);effect.event('afterFinish');});}});Effect.Opacity=Class.create();Object.extend(Object.extend(Effect.Opacity.prototype,Effect.Base.prototype),{initialize:function(element){this.element=$(element);if(/MSIE/.test(navigator.userAgent)&&(!this.element.hasLayout))
this.element.setStyle({zoom:1});var options=Object.extend({from:this.element.getOpacity()||0.0,to:1.0},arguments[1]||{});this.start(options);},update:function(position){this.element.setOpacity(position);}});Effect.Move=Class.create();Object.extend(Object.extend(Effect.Move.prototype,Effect.Base.prototype),{initialize:function(element){this.element=$(element);var options=Object.extend({x:0,y:0,mode:'relative'},arguments[1]||{});this.start(options);},setup:function(){this.element.makePositioned();this.originalLeft=parseFloat(this.element.getStyle('left')||'0');this.originalTop=parseFloat(this.element.getStyle('top')||'0');if(this.options.mode=='absolute'){this.options.x=this.options.x-this.originalLeft;this.options.y=this.options.y-this.originalTop;}},update:function(position){this.element.setStyle({left:this.options.x*position+this.originalLeft+'px',top:this.options.y*position+this.originalTop+'px'});}});Effect.MoveBy=function(element,toTop,toLeft){return new Effect.Move(element,Object.extend({x:toLeft,y:toTop},arguments[3]||{}));};Effect.Scale=Class.create();Object.extend(Object.extend(Effect.Scale.prototype,Effect.Base.prototype),{initialize:function(element,percent){this.element=$(element)
var options=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:'box',scaleFrom:100.0,scaleTo:percent},arguments[2]||{});this.start(options);},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle('position');this.originalStyle={};['top','left','width','height','fontSize'].each(function(k){this.originalStyle[k]=this.element.style[k];}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var fontSize=this.element.getStyle('font-size')||'100%';['em','px','%'].each(function(fontSizeType){if(fontSize.indexOf(fontSizeType)>0){this.fontSize=parseFloat(fontSize);this.fontSizeType=fontSizeType;}}.bind(this));this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;this.dims=null;if(this.options.scaleMode=='box')
this.dims=[this.element.offsetHeight,this.element.offsetWidth];if(/^content/.test(this.options.scaleMode))
this.dims=[this.element.scrollHeight,this.element.scrollWidth];if(!this.dims)
this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth];},update:function(position){var currentScale=(this.options.scaleFrom/100.0)+(this.factor*position);if(this.options.scaleContent&&this.fontSize)
this.element.setStyle({fontSize:this.fontSize*currentScale+this.fontSizeType});this.setDimensions(this.dims[0]*currentScale,this.dims[1]*currentScale);},finish:function(position){if(this.restoreAfterFinish)this.element.setStyle(this.originalStyle);},setDimensions:function(height,width){var d={};if(this.options.scaleX)d.width=width+'px';if(this.options.scaleY)d.height=height+'px';if(this.options.scaleFromCenter){var topd=(height-this.dims[0])/2;var leftd=(width-this.dims[1])/2;if(this.elementPositioning=='absolute'){if(this.options.scaleY)d.top=this.originalTop-topd+'px';if(this.options.scaleX)d.left=this.originalLeft-leftd+'px';}else{if(this.options.scaleY)d.top=-topd+'px';if(this.options.scaleX)d.left=-leftd+'px';}}
this.element.setStyle(d);}});Effect.Highlight=Class.create();Object.extend(Object.extend(Effect.Highlight.prototype,Effect.Base.prototype),{initialize:function(element){this.element=$(element);var options=Object.extend({startcolor:'#ffff99'},arguments[1]||{});this.start(options);},setup:function(){if(this.element.getStyle('display')=='none'){this.cancel();return;}
this.oldStyle={backgroundImage:this.element.getStyle('background-image')};this.element.setStyle({backgroundImage:'none'});if(!this.options.endcolor)
this.options.endcolor=this.element.getStyle('background-color').parseColor('#ffffff');if(!this.options.restorecolor)
this.options.restorecolor=this.element.getStyle('background-color');this._base=$R(0,2).map(function(i){return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(i){return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i]}.bind(this));},update:function(position){this.element.setStyle({backgroundColor:$R(0,2).inject('#',function(m,v,i){return m+(Math.round(this._base[i]+(this._delta[i]*position)).toColorPart());}.bind(this))});},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}));}});Effect.ScrollTo=Class.create();Object.extend(Object.extend(Effect.ScrollTo.prototype,Effect.Base.prototype),{initialize:function(element){this.element=$(element);this.start(arguments[1]||{});},setup:function(){Position.prepare();var offsets=Position.cumulativeOffset(this.element);if(this.options.offset)offsets[1]+=this.options.offset;var max=window.innerHeight?window.height-window.innerHeight:document.body.scrollHeight-
(document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight);this.scrollStart=Position.deltaY;this.delta=(offsets[1]>max?max:offsets[1])-this.scrollStart;},update:function(position){Position.prepare();window.scrollTo(Position.deltaX,this.scrollStart+(position*this.delta));}});Effect.Fade=function(element){element=$(element);var oldOpacity=element.getInlineOpacity();var options=Object.extend({from:element.getOpacity()||1.0,to:0.0,afterFinishInternal:function(effect){if(effect.options.to!=0)return;effect.element.hide();effect.element.setStyle({opacity:oldOpacity});}},arguments[1]||{});return new Effect.Opacity(element,options);}
Effect.Appear=function(element){element=$(element);var options=Object.extend({from:(element.getStyle('display')=='none'?0.0:element.getOpacity()||0.0),to:1.0,afterFinishInternal:function(effect){effect.element.forceRerendering();},beforeSetup:function(effect){effect.element.setOpacity(effect.options.from);effect.element.show();}},arguments[1]||{});return new Effect.Opacity(element,options);}
Effect.Puff=function(element){element=$(element);var oldStyle={opacity:element.getInlineOpacity(),position:element.getStyle('position')};return new Effect.Parallel([new Effect.Scale(element,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(element,{sync:true,to:0.0})],Object.extend({duration:1.0,beforeSetupInternal:function(effect){effect.effects[0].element.setStyle({position:'absolute'});},afterFinishInternal:function(effect){effect.effects[0].element.hide();effect.effects[0].element.setStyle(oldStyle);}},arguments[1]||{}));}
Effect.BlindUp=function(element){element=$(element);element.makeClipping();return new Effect.Scale(element,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(effect){effect.element.hide();effect.element.undoClipping();}},arguments[1]||{}));}
Effect.BlindDown=function(element){element=$(element);var elementDimensions=element.getDimensions();return new Effect.Scale(element,100,Object.extend({scaleContent:false,scaleY:false,scaleFrom:0,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makeClipping();effect.element.setStyle({width:'0px'});effect.element.show();},afterFinishInternal:function(effect){effect.element.undoClipping();}},arguments[1]||{}));}
Effect.SlideRightIntoView=function(element){$(element).style.width='0px';$(element).style.overflow='hidden';$(element).firstChild.style.position='relative';Element.show(element);new Effect.Scale(element,100,Object.extend(arguments[1]||{},{scaleContent:false,scaleY:false,scaleMode:'contents',scaleFrom:0,afterUpdate:function(effect){}}));}
Effect.SlideRightOutOfView=function(element){$(element).style.overflow='hidden';$(element).firstChild.style.position='relative';Element.show(element);new Effect.Scale(element,0,Object.extend(arguments[1]||{},{scaleContent:false,scaleY:false,afterUpdate:function(effect){},afterFinish:function(effect)
{Element.hide(effect.element);}}));}
Effect.SlideLeftAndRight=function(element){element=$(element);if(Element.visible(element))new Effect.SlideRightOutOfView(element);else new Effect.SlideRightIntoView(element);}
Effect.BlindRight=function(element){element=$(element);var elementDimensions=element.getDimensions();return new Effect.Scale(element,100,Object.extend({scaleContent:false,scaleY:false,scaleFrom:0,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makeClipping().setStyle({width:'0px'}).show();},afterFinishInternal:function(effect){effect.element.undoClipping();}},arguments[1]||{}));}
Effect.SwitchOff=function(element){element=$(element);var oldOpacity=element.getInlineOpacity();return new Effect.Appear(element,{duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(effect){new Effect.Scale(effect.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(effect){effect.element.makePositioned();effect.element.makeClipping();},afterFinishInternal:function(effect){effect.element.hide();effect.element.undoClipping();effect.element.undoPositioned();effect.element.setStyle({opacity:oldOpacity});}})}});}
Effect.DropOut=function(element){element=$(element);var oldStyle={top:element.getStyle('top'),left:element.getStyle('left'),opacity:element.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(element,{x:0,y:100,sync:true}),new Effect.Opacity(element,{sync:true,to:0.0})],Object.extend({duration:0.5,beforeSetup:function(effect){effect.effects[0].element.makePositioned();},afterFinishInternal:function(effect){effect.effects[0].element.hide();effect.effects[0].element.undoPositioned();effect.effects[0].element.setStyle(oldStyle);}},arguments[1]||{}));}
Effect.Shake=function(element){element=$(element);var oldStyle={top:element.getStyle('top'),left:element.getStyle('left')};return new Effect.Move(element,{x:20,y:0,duration:0.05,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-40,y:0,duration:0.1,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:40,y:0,duration:0.1,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-40,y:0,duration:0.1,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:40,y:0,duration:0.1,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-20,y:0,duration:0.05,afterFinishInternal:function(effect){effect.element.undoPositioned();effect.element.setStyle(oldStyle);}})}})}})}})}})}});}
Effect.SlideDown=function(element){element=$(element);element.cleanWhitespace();var oldInnerBottom=$(element.firstChild).getStyle('bottom');var elementDimensions=element.getDimensions();return new Effect.Scale(element,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makePositioned();effect.element.firstChild.makePositioned();if(window.opera)effect.element.setStyle({top:''});effect.element.makeClipping();effect.element.setStyle({height:'0px'});effect.element.show();},afterUpdateInternal:function(effect){effect.element.firstChild.setStyle({bottom:(effect.dims[0]-effect.element.clientHeight)+'px'});},afterFinishInternal:function(effect){effect.element.undoClipping();if(/MSIE/.test(navigator.userAgent)){effect.element.undoPositioned();effect.element.firstChild.undoPositioned();}else{effect.element.firstChild.undoPositioned();effect.element.undoPositioned();}
effect.element.firstChild.setStyle({bottom:oldInnerBottom});}},arguments[1]||{}));}
Effect.SlideUp=function(element){element=$(element);element.cleanWhitespace();var oldInnerBottom=$(element.firstChild).getStyle('bottom');return new Effect.Scale(element,0,Object.extend({scaleContent:false,scaleX:false,scaleMode:'box',scaleFrom:100,restoreAfterFinish:true,beforeStartInternal:function(effect){effect.element.makePositioned();effect.element.firstChild.makePositioned();if(window.opera)effect.element.setStyle({top:''});effect.element.makeClipping();effect.element.show();},afterUpdateInternal:function(effect){effect.element.firstChild.setStyle({bottom:(effect.dims[0]-effect.element.clientHeight)+'px'});},afterFinishInternal:function(effect){effect.element.hide();effect.element.undoClipping();effect.element.firstChild.undoPositioned();effect.element.undoPositioned();effect.element.setStyle({bottom:oldInnerBottom});}},arguments[1]||{}));}
Effect.Squish=function(element){return new Effect.Scale(element,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(effect){effect.element.makeClipping(effect.element);},afterFinishInternal:function(effect){effect.element.hide(effect.element);effect.element.undoClipping(effect.element);}});}
Effect.Grow=function(element){element=$(element);var options=Object.extend({direction:'center',moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var oldStyle={top:element.style.top,left:element.style.left,height:element.style.height,width:element.style.width,opacity:element.getInlineOpacity()};var dims=element.getDimensions();var initialMoveX,initialMoveY;var moveX,moveY;switch(options.direction){case'top-left':initialMoveX=initialMoveY=moveX=moveY=0;break;case'top-right':initialMoveX=dims.width;initialMoveY=moveY=0;moveX=-dims.width;break;case'bottom-left':initialMoveX=moveX=0;initialMoveY=dims.height;moveY=-dims.height;break;case'bottom-right':initialMoveX=dims.width;initialMoveY=dims.height;moveX=-dims.width;moveY=-dims.height;break;case'center':initialMoveX=dims.width/2;initialMoveY=dims.height/2;moveX=-dims.width/2;moveY=-dims.height/2;break;}
return new Effect.Move(element,{x:initialMoveX,y:initialMoveY,duration:0.01,beforeSetup:function(effect){effect.element.hide();effect.element.makeClipping();effect.element.makePositioned();},afterFinishInternal:function(effect){new Effect.Parallel([new Effect.Opacity(effect.element,{sync:true,to:1.0,from:0.0,transition:options.opacityTransition}),new Effect.Move(effect.element,{x:moveX,y:moveY,sync:true,transition:options.moveTransition}),new Effect.Scale(effect.element,100,{scaleMode:{originalHeight:dims.height,originalWidth:dims.width},sync:true,scaleFrom:window.opera?1:0,transition:options.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(effect){effect.effects[0].element.setStyle({height:'0px'});effect.effects[0].element.show();},afterFinishInternal:function(effect){effect.effects[0].element.undoClipping();effect.effects[0].element.undoPositioned();effect.effects[0].element.setStyle(oldStyle);}},options))}});}
Effect.Shrink=function(element){element=$(element);var options=Object.extend({direction:'center',moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var oldStyle={top:element.style.top,left:element.style.left,height:element.style.height,width:element.style.width,opacity:element.getInlineOpacity()};var dims=element.getDimensions();var moveX,moveY;switch(options.direction){case'top-left':moveX=moveY=0;break;case'top-right':moveX=dims.width;moveY=0;break;case'bottom-left':moveX=0;moveY=dims.height;break;case'bottom-right':moveX=dims.width;moveY=dims.height;break;case'center':moveX=dims.width/2;moveY=dims.height/2;break;}
return new Effect.Parallel([new Effect.Opacity(element,{sync:true,to:0.0,from:1.0,transition:options.opacityTransition}),new Effect.Scale(element,window.opera?1:0,{sync:true,transition:options.scaleTransition,restoreAfterFinish:true}),new Effect.Move(element,{x:moveX,y:moveY,sync:true,transition:options.moveTransition})],Object.extend({beforeStartInternal:function(effect){effect.effects[0].element.makePositioned();effect.effects[0].element.makeClipping();},afterFinishInternal:function(effect){effect.effects[0].element.hide();effect.effects[0].element.undoClipping();effect.effects[0].element.undoPositioned();effect.effects[0].element.setStyle(oldStyle);}},options));}
Effect.Pulsate=function(element){element=$(element);var options=arguments[1]||{};var oldOpacity=element.getInlineOpacity();var transition=options.transition||Effect.Transitions.sinoidal;var reverser=function(pos){return transition(1-Effect.Transitions.pulse(pos))};reverser.bind(transition);return new Effect.Opacity(element,Object.extend(Object.extend({duration:2.0,from:0,afterFinishInternal:function(effect){effect.element.setStyle({opacity:oldOpacity});}},options),{transition:reverser}));}
Effect.Fold=function(element){element=$(element);var oldStyle={top:element.style.top,left:element.style.left,width:element.style.width,height:element.style.height};Element.makeClipping(element);return new Effect.Scale(element,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(effect){new Effect.Scale(element,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(effect){effect.element.hide();effect.element.undoClipping();effect.element.setStyle(oldStyle);}});}},arguments[1]||{}));};['setOpacity','getOpacity','getInlineOpacity','forceRerendering','setContentZoom','collectTextNodes','collectTextNodesIgnoreClass','childrenWithClassName'].each(function(f){Element.Methods[f]=Element[f];});Element.Methods.visualEffect=function(element,effect,options){s=effect.gsub(/_/,'-').camelize();effect_class=s.charAt(0).toUpperCase()+s.substring(1);new Effect[effect_class](element,options);return $(element);};Element.addMethods();;function theValidator(theForm,theControl,theMessage,theNumeric,theEMail,theURL,theConfirmPassword,thebadstuff,theinteger,thepercent,thesize,thedecimal,theimage,theempty,themin,themax,thecheckboxlength,thephoneno)
{var theMessages=new Array();var theNumerics=new Array();var theEMails=new Array();var theURLs=new Array();var theConfirmPasswords=new Array();theControls=theControl.split(",");theMessages=theMessage.split(",");theNumerics=theNumeric.split(",");theEMails=theEMail.split(",");theURLs=theURL.split(",");thebadstuffs=thebadstuff.split(",");theintegers=theinteger.split(",");thepercents=thepercent.split(",");thesizes=thesize.split(",");thedecimals=thedecimal.split(",");theimages=theimage.split(",");theemptys=theempty.split(",");themins=themin.split(",");themaxs=themax.split(",");thecheckboxlengths=thecheckboxlength.split(",");theConfirmPasswords=theConfirmPassword.split(",");thephonenos=thephoneno.split(",");for(var i=0;i<theForm.elements.length;i++){for(var counter=0;counter<theControls.length;counter++)
{if(theForm.elements[i].name==theControls[counter])
{if(theForm.elements[i].type=='file')
{if(trim(theForm.elements[i].value)==''&&theemptys[counter]=="Y")
{alert("Please enter the "+theMessages[counter].toLowerCase()+".");theForm.elements[i].focus();return false;}
else
{if(theimages[counter]=="Y")
{var s=theForm.elements[i].value;if(s!="")
{array=s.split("\\");len=array.length;filename=array[len-1];array1=filename.split(".");len1=array1.length;len1=len1-1;if(array1.length==1)
{alert("Files with extensions .gif, .jpg, .jpeg can only be uploaded.");theForm.elements[i].focus();return false;}
if(array1[len1].toLowerCase()!="jpg"&&array1[len1].toLowerCase()!="jpeg"&&array1[len1].toLowerCase()!="gif")
{alert("Files with extensions .gif, .jpg, .jpeg can only be uploaded.");theForm.elements[i].focus();return false;}}}
if(theimages[counter]=="C")
{var s=theForm.elements[i].value;if(s!="")
{array=s.split("\\");len=array.length;filename=array[len-1];array1=filename.split(".");len1=array1.length;len1=len1-1;if(array1.length==1)
{alert("Files with extensions .txt, .doc, .pdf can only be uploaded.");theForm.elements[i].focus();return false;}
if(array1[len1].toLowerCase()!="txt"&&array1[len1].toLowerCase()!="doc"&&array1[len1].toLowerCase()!="pdf")
{alert("Files with extensions .txt, .doc, .pdf can only be uploaded.");theForm.elements[i].focus();return false;}}}
if(theimages[counter]=="YC")
{var s=theForm.elements[i].value;if(s!="")
{array=s.split("\\");len=array.length;filename=array[len-1];array1=filename.split(".");len1=array1.length;len1=len1-1;if(array1.length==1)
{alert("Files with extensions .gif, .jpg, .jpeg, .txt, .doc, .pdf can only be uploaded.");theForm.elements[i].focus();return false;}
if(array1[len1].toLowerCase()!="jpg"&&array1[len1].toLowerCase()!="jpeg"&&array1[len1].toLowerCase()!="gif"&&array1[len1].toLowerCase()!="txt"&&array1[len1].toLowerCase()!="doc"&&array1[len1].toLowerCase()!="pdf")
{alert("Files with extensions .gif, .jpg, .jpeg, .txt, .doc, .pdf can only be uploaded.");theForm.elements[i].focus();return false;}}}
if(theimages[counter]=="I")
{var s=theForm.elements[i].value;if(s!="")
{array=s.split("\\");len=array.length;filename=array[len-1];array1=filename.split(".");len1=array1.length;len1=len1-1;if(array1.length==1)
{alert("Files with extensions .gif, .jpg, .jpeg can only be uploaded.");theForm.elements[i].focus();return false;}
if(array1[len1].toLowerCase()!="jpg"&&array1[len1].toLowerCase()!="jpeg"&&array1[len1].toLowerCase()!="gif")
{alert("Files with extensions .gif, .jpg, .jpeg can only be uploaded.");theForm.elements[i].focus();return false;}}}
if(theimages[counter]=="M")
{var s=theForm.elements[i].value;if(s!="")
{array=s.split("\\");len=array.length;filename=array[len-1];array1=filename.split(".");len1=array1.length;len1=len1-1;if(array1.length==1)
{alert("Files with extensions .mpg, .mpeg, .avi, .mov, .rm, .wmv, .asf can only be uploaded.");theForm.elements[i].focus();return false;}
if(array1[len1].toLowerCase()!="mpg"&&array1[len1].toLowerCase()!="mpeg"&&array1[len1].toLowerCase()!="avi"&&array1[len1].toLowerCase()!="mov"&&array1[len1].toLowerCase()!="rm"&&array1[len1].toLowerCase()!="wmv"&&array1[len1].toLowerCase()!="asf")
{alert("Files with extensions .mpg, .mpeg, .avi, .mov, .rm, .wmv, .asf can only be uploaded.");theForm.elements[i].focus();return false;}}}}}
if((theForm.elements[i].type=="select-one")||(theForm.elements[i].type=="select-multiple"))
{var selIndex,selValue;selIndex=theForm.elements[i].selectedIndex;var theObject=theForm.elements[i];selValue=theObject[selIndex].value;if(trim(selValue)==""||trim(selValue)=="0")
{alert("Please select the "+theMessages[counter].toLowerCase()+".");theForm.elements[i].focus();return false;}}
if(theForm.elements[i].type=='text')
{if(trim(theForm.elements[i].value)==''&&theemptys[counter]=="Y")
{alert("Please enter the "+theMessages[counter].toLowerCase()+".");theForm.elements[i].focus();return false;}
if(trim(theForm.elements[i].value)!=''&&theNumerics[counter]=="Y")
{if(isNaN(trim(theForm.elements[i].value)))
{alert("Please enter numeric values for "+theMessages[counter].toLowerCase()+".");theForm.elements[i].focus();return false;}
if(trim(theForm.elements[i].value)<=0)
{alert("Please enter "+theMessages[counter].toLowerCase()+" greater than  0 (zero).");theForm.elements[i].focus();return false;}}
if(trim(theForm.elements[i].value)!=''&&theintegers[counter]=="Y")
{if(isNaN(trim(theForm.elements[i].value)))
{alert("Please enter numeric values for "+theMessages[counter].toLowerCase()+".");theForm.elements[i].focus();return false;}
if(parseInt(trim(theForm.elements[i].value))<0)
{alert("Please enter "+theMessages[counter].toLowerCase()+" greater than or equal to 0 (zero).");theForm.elements[i].focus();return false;}}
if((trim(theForm.elements[i].value)!='')&&(thebadstuffs[counter]!=""))
{if(thebadstuffs[counter]==1||thebadstuffs[counter]==7)
badStuff="~`!@#$%^&*()=+|<>?;:/\"\\";else if(thebadstuffs[counter]==2)
badStuff="~`!@$%^&*()=+|<>?;:/\"\\";else if(thebadstuffs[counter]==3)
badStuff="~`!@$%^&* ()=+|<>?;\"";else if(thebadstuffs[counter]==4)
badStuff="0123456789~`!@#$%^&*()=+|<>?;:/\"\\";else
badStuff='"';chkstring=trim(theForm.elements[i].value);for(x=0;x<badStuff.length;x++)
{badCheck=badStuff.charAt(x);if(chkstring.indexOf(badCheck,0)!=-1)
{if(badStuff=='"')
alert("Please replace double quotes with single quotes for "+theMessages[counter].toLowerCase()+".");else
{abc=theMessages[counter].replace(theMessages[counter],theMessages[counter].charAt(0).toUpperCase());if(thebadstuffs[counter]==7)
alert(abc+theMessages[counter].substring(1,theMessages[counter].length)+" can not have special characters.");else
alert(abc+theMessages[counter].substring(1,theMessages[counter].length)+" can not have special characters or numerics.");}
theForm.elements[i].focus();return false;}}
badStuff="";flg=0;if(thebadstuffs[counter]==5||thebadstuffs[counter]==7)
badStuff="0123456789";else if(thebadstuffs[counter]==6)
badStuff="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";if(badStuff!=""){for(x=0;x<badStuff.length;x++)
{badCheck=badStuff.charAt(x);if(chkstring.indexOf(badCheck,0)==-1)
flg=1;else{flg=0;break;}}
if(flg==1)
{abc=theMessages[counter].replace(theMessages[counter],theMessages[counter].charAt(0).toUpperCase());if(thebadstuffs[counter]==5||thebadstuffs[counter]==7)
alert(abc+theMessages[counter].substring(1,theMessages[counter].length)+" can not have all the characters .");else
alert(abc+theMessages[counter].substring(1,theMessages[counter].length)+" can not have all the numbers.");theForm.elements[i].focus();return false;}}}
if(trim(theForm.elements[i].value)!=''&&thepercents[counter]=='Y')
{if(parseInt(theForm.elements[i].value)<0||parseInt(theForm.elements[i].value)>100)
{alert(theMessages[counter].toLocaleUpperCase()+" should have value between 0 to 100.");theForm.elements[i].focus();return false;}}
if(trim(theForm.elements[i].value)!=''&&thesizes[counter]!="")
{if(trim(theForm.elements[i].value).length>thesizes[counter])
{alert("Maximum characters allowed are "+thesizes[counter]+". Entered are "+theForm.elements[i].value.length+" characters.");theForm.elements[i].focus();return false;}}
if(trim(theForm.elements[i].value)!=''&&thedecimals[counter]!="")
{var str=theForm.elements[i].value;if(str.indexOf('.')!=-1)
{alert("No decimals allowed for "+theMessages[counter].toLowerCase()+".");theForm.elements[i].focus();return false;}}
if(trim(theForm.elements[i].value)!=''&&thephonenos[counter]!="")
{var regexp=/^(\d{3}-\d{3}-\d{4}|\d{10}|\(\d{3}\)\d{3}-\d{4}|\d{6}|\d{7}|\d{8})$/;x=trim(theForm.elements[i].value);if(!(regexp.test(x)))
{var msg="";msg="Please enter the correct "+theMessages[counter].toLowerCase();msg=msg+"\n The correct forms are : ";msg=msg+"\n xxx-xxx-xxxx";msg=msg+"\n (xxx)xxx-xxxx";msg=msg+"\n xxxxxxxxxx (10 digited Mobile no)";msg=msg+"\n xxxxxx (6 digits no)";msg=msg+"\n xxxxxxx (7 digits no)";msg=msg+"\n xxxxxxxx (8 digits no)";alert(msg);theForm.elements[i].focus();return false;}}
if(trim(theForm.elements[i].value)!=''&&theEMails[counter]=="Y")
{if(!emailcheck(theForm.elements[i],"Please enter valid email address."))return false;}
if(trim(theForm.elements[i].value)!=''&&theURLs[counter]=="Y")
{if(!validateURL(trim(theForm.elements[i].value)))
{alert("Please enter valid url. \n http://www.domain.com");theForm.elements[i].focus();return false;}}
if(trim(theForm.elements[i].value)!=''&&themins[counter]!=''&&themaxs[counter]!='')
{if(parseInt(theForm.elements[i].value)<themins[counter]||parseInt(theForm.elements[i].value)>themaxs[counter])
{alert("Please enter value for "+theMessages[counter].toLowerCase()+" between "+themins[counter]+" and "+themaxs[counter]+".");theForm.elements[i].focus();return false;}}
if(trim(theForm.elements[i].value)!=''&&themins[counter]!=''&&themaxs[counter]=='')
{if((theForm.elements[i].value.length)<themins[counter])
{alert("Please enter valid "+theMessages[counter].toLowerCase()+".");theForm.elements[i].focus();return false;}}
if(trim(theForm.elements[i].value)!=''&&themaxs[counter]!='')
{if(parseInt(theForm.elements[i].value)>themaxs[counter])
{alert("Please enter value for "+theMessages[counter].toLowerCase()+" less than or equal to "+themaxs[counter]+".");theForm.elements[i].focus();return false;}}}
if(theForm.elements[i].type=='password'&&theConfirmPasswords[counter]!="Y"&&theemptys[counter]=="Y")
{if(trim(theForm.elements[i].value)=='')
{alert("Please enter the "+theMessages[counter].toLowerCase()+".");theForm.elements[i].focus();return false;}
if(theForm.elements[i].value.length>14)
{alert("Password cannot have more than 14 characters.");theForm.elements[i].focus();return false;}}
if(theForm.elements[i].type=='password'&&theConfirmPasswords[counter]=="Y")
{if(trim(theForm.elements[i].value)=='')
{alert("Please retype the "+theMessages[counter].toLowerCase()+".");theForm.elements[i].focus();return false;}
if(theForm.elements[i].value.length>14)
{alert("Password cannot have more than 14 characters.");theForm.elements[i].focus();return false;}
if(theForm.elements[i].value.length<6)
{alert("Password cannot be less than 6 characters.");theForm.elements[i].focus();return false;}
if(theForm.elements[i].value!=theForm.elements[i-1].value)
{alert("Passwords do not match.");theForm.elements[i].focus();return false;}}
if(theForm.elements[i].type=="checkbox"&&theemptys[counter]=="Y")
{var flagchecked="0";if(parseInt(thecheckboxlengths[counter])>1)
{for(j=i;j<i+parseInt(thecheckboxlengths[counter]);j++)
{checkbox1=eval(theForm.elements[j]);if(checkbox1.checked==true)
{flagchecked="1";break;}}}
else
{if(theForm.checkboxname.checked==true)
{flagchecked="1";}}
if(flagchecked=="0")
{alert("Please select the "+theMessages[counter].toLowerCase()+".");theForm.elements[i].focus();return false;}
i=i+parseInt(thecheckboxlengths[counter])-1;}
if(theForm.elements[i].type=="textarea")
{var txtAreaValue;txtAreaValue=theForm.elements[i].value;if(trim(txtAreaValue)==""&&theemptys[counter]=="Y")
{alert("Please enter the "+theMessages[counter].toLowerCase()+".");theForm.elements[i].focus();return false;}
if(trim(theForm.elements[i].value)!=''&&thesizes[counter]!="")
{if(trim(theForm.elements[i].value).length>thesizes[counter])
{alert("Maximum characters allowed are "+thesizes[counter]+". Entered are "+theForm.elements[i].value.length+" characters.");theForm.elements[i].focus();return false;}}}}}}
return true;}
function checkUncheckAll(theElement)
{var theForm=theElement.form,z=0;for(var i=0;i<theForm.elements.length;i++)
{if(theForm.elements[i].type!='checkbox')
z++;else
break;}
while(theForm[z].type=='checkbox'&&theForm[z].name!='checkall')
{theForm[z].checked=theElement.checked;z++;}}
function getRadioButtonValue(theForm,theControl)
{var i;alert("Hello "+theForm+" control.length: "+theControl.length);for(i=0;i<theControl.length;++i)
{alert(theForm[i].checked);if(theControl[i].checked)
{return theControl[i].value;}}
return-1;}
function ltrim(s)
{return s.replace(/^\s*/,"")}
function rtrim(s)
{return s.replace(/\s*$/,"");}
function trim(str)
{return((""+str).replace(/^\s*([\s\S]*\S+)\s*$|^\s*$/,'$1'));}
function emailcheck(object,str)
{var email=object.value;var matcharray=email.match(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)
if(matcharray==null){alert(str)
object.focus();object.select();return false;}
else return true}
function validateEmail(email){if(email==""){return false;}
badStuff=";:/,' \"\\";for(i=0;i<badStuff.length;i++){badCheck=badStuff.charAt(i)
if(email.indexOf(badCheck,0)!=-1){return false;}}
posOfAtSign=email.indexOf("@",1)
if(posOfAtSign==-1){return false;}
if(email.indexOf("@",posOfAtSign+1)!=-1){return false;}
posOfPeriod=email.indexOf(".",posOfAtSign)
if(posOfPeriod==-1){return false;}
if(posOfPeriod+2>email.length){return false;}
return true}
function validateURL(myobject)
{var re;var checkend=/\w\.[a-zA-Z]{2,3}/;url=myobject;if(url.search(checkend)==-1)
{return false;}
return true;}
function validateURL1(myobject)
{var re;var checkend=/\w\.[a-zA-Z]{2,3}$/;url=myobject.value;if(url.search(checkend)==-1)
{alert("Please enter valid url. \n http://www.domain.com");return false;}
return true;}
function MM_openBrWindow(theURL,winName,features){width=screen.width-50;height=screen.height-100;features="scrollbars=yes,resizable=yes,width="+width+",height="+height+",left=0,top=0";window.open(theURL,winName,features);}
function MM_openHelpWindow(theURL,winName,features,spos){winName="new";width=screen.width-350;height=screen.height-450;if(spos==1){stop=0;sleft=0;}
if(spos==2){sleft=screen.width-width;stop=0;}
if(spos==3){stop=screen.height-height;sleft=0;}
if(spos==4){stop=screen.height-height;sleft=screen.width-width;}
features="scrollbars=yes,resizable=yes,width="+width+",height="+height+",left="+sleft+",top="+stop;newpopupwindow=window.open(theURL,'new',features);}
function isvalidname(obj,msg)
{var chk="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-'0123456789. ";var str=obj.value;var allvalid=1;for(i=0;i<str.length;i++)
{ch=str.charAt(i);if(chk.indexOf(ch)==-1)
{allvalid=0;}}
if(allvalid==0)
{alert(msg+" can not have special characters.");obj.focus();obj.select();return false;}
return true;}
function confirmCatDelete(theform,msg)
{if(confirm("Are you sure you want to delete this "+msg+"?"))
{formName=eval("document."+theform);formName.flag.value=1;formName.submit();}}
function checkQuantity(theform)
{var flag=0;for(i=0;i<theform.length;i=i+2)
{if(theform.elements[i].checked==true)
{flag=1;if(confirm("Are you sure you want delete this record?"))
return true;else
return false;}}
if(flag==0)
{for(i=1;i<theform.length;i=i+2)
{if(isNaN(theform.elements[i].value))
{alert("Quantity should be numeric.");theform.elements[i].focus();return false;}
if(theform.elements[i].value<0)
{alert("Quantity should be greater than 0.");theform.elements[i].focus();return false;}}
return true;}}
function checkdate(theform)
{day1=theform.dd1.options[theform.dd1.selectedIndex].value;mon1=theform.mm1.options[theform.mm1.selectedIndex].value;year1=theform.yy1.options[theform.yy1.selectedIndex].value;day2=theform.dd2.options[theform.dd2.selectedIndex].value;mon2=theform.mm2.options[theform.mm2.selectedIndex].value;year2=theform.yy2.options[theform.yy2.selectedIndex].value;var fromdate=new Date(year1,mon1,day1);var todate=new Date(year2,mon2,day2);if(fromdate>todate)
{alert("From date should be less than to date.");theform.dd2.focus();return false;}
return true;}
function validate(field,maxlen,str)
{if(field.value.length>maxlen)
{alert(str+" cannot have more than "+maxlen+" characters.");field.focus();return false;}
return true;}
function validate_min_len(field,minlen,str)
{if(field.value.length<minlen)
{alert(str+" cannot be less than "+minlen+" characters.");field.focus();return false;}
return true;}
function fileextension(object,str)
{var s=object.value;if(s!="")
{array=s.split("\\");len=array.length;filename=array[len-1];array1=filename.split(".");if(array1[1]!="jpg"&&array1[1]!="jpeg"&&array1[1]!="gif")
{alert(str);object.focus();return false;}}
return true;}
function emailcheck(object,str)
{var email=object.value;var matcharray=email.match(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)
if(matcharray==null){alert(str)
object.focus();object.select();return false;}
else return true}
function yearcheck(number)
{if(number<1000)
{number=number+1900;}
return number;}
function changedate(theform,i)
{if(i==0)
{theformdd=eval(theform.dd1);theformmm=eval(theform.mm1);theformyy=eval(theform.yy1);}
else
{theformdd=eval(theform.dd2);theformmm=eval(theform.mm2);theformyy=eval(theform.yy2);}
day1=theformdd.options[theformdd.selectedIndex].value;month1=theformmm.options[theformmm.selectedIndex].value;month1=month1-1;year1=theformyy.options[theformyy.selectedIndex].value;var test=new Date(year1,month1,day1);aday=test.getDate();if((parseInt(yearcheck(test.getYear()))==parseInt(year1))&&(parseInt(month1)==parseInt(test.getMonth()))&&(parseInt(day1)==parseInt(test.getDate())))
{newdate=new Date(year1,month1,aday);dayNew=eval("theformdd.options[theformdd.selectedIndex]");dayNew.value=newdate.getDate();optionNumber=newdate.getDate();aku=eval("theformdd.options[optionNumber-1]");aku.selected=true;monthNew=eval("theformmm.options[theformmm.selectedIndex]");if(newdate.getMonth()==0&&newdate.getDate()==1&&newdate.getFullYear()>year1)
{monthNew.value=1;opmonth=1;}
else
{monthNew.value=newdate.getMonth()+1;opmonth=newdate.getMonth()+1;}
amu=eval("theformmm.options[opmonth-1]");amu.selected=true;yearNew=eval("theformyy.options[theformyy.selectedIndex]");yearNew.value=newdate.getFullYear();opyear=newdate.getFullYear();abc=eval("theformyy");for(var u=0;u<abc.options.length;u++)
{if(yearNew.value==abc.options[u].text)
{ayu=eval("theformyy.options[u]");ayu.selected=true;}}}
else
{alert("Please enter valid date.");theformdd.focus();return false;}
return true;}
function pause(numberMillis)
{var now=new Date();var exitTime=now.getTime()+numberMillis;while(true)
{now=new Date();if(now.getTime()>exitTime)
return;}}
function textCounter(field,maxlimit)
{if(field.value.length>maxlimit)
field.value=field.value.substring(0,maxlimit);}
function delfaq()
{if(!confirm("Are you sure you want to delete this FAQ?"))
return false;return true;}
function delTestimonial()
{if(!confirm("Are you sure you want to delete this testimonial?"))
return false;return true;}
function del(str)
{if(!confirm("Are you sure you want to delete this "+str+"?"))
return false;return true;}
function add_group(src,dst)
{var selectone=src;var selecttwo=dst;var i=0;while(i<selectone.length)
{if(selectone.options[i].selected==true)
{var selecttwolength=selecttwo.length;selecttwo.options[selecttwolength]=new Option(selectone.options[i].text);selecttwo.options[selecttwolength].value=selectone.options[i].value;selectone.options[i]=null;i=i-1;}
i=i+1;}}
function remove_group(src,dst)
{var selectone=src;var selecttwo=dst;k=(selecttwo.length-1);var i=k;while(i>=0)
{if(selecttwo.options[i].selected==true)
{var selectonelength=selectone.length;var selectoneOption=new Option(selecttwo.options[i].text);selectone.options[selectonelength]=selectoneOption;selecttwo.options[i]=null;k=k-1;}
i=i-1;}}
function addfav(){if((navigator.appName=="Microsoft Internet Explorer")&&(parseInt(navigator.appVersion)>=4)){var url="http://www.ofni.us";var title="OFNI the info base";window.external.AddFavorite(url,title);}
else{var msg="Don't forget to bookmark us!";if(navigator.appName=="Netscape")msg+="  (CTRL-D)";document.write(msg);}}
function checkQuantity(startelement,endelement)
{flag=0;for(i=startelement;i<document.form5.length-endelement;i=i+3)
{if(isNaN(document.form5.elements[i].value))
{alert("Quantity should be numeric.");document.form5.elements[i].focus();flag=1;break;}
if(document.form5.elements[i].value<=0)
{alert("Quantity should be greater than 0.");document.form5.elements[i].focus();flag=1;break;}}
if(flag==0)
{document.form5.action1.value="recalculate";document.form5.submit();return true;}}
function confirmdelete(theform,startElement,endElement,message)
{var flag=0;for(var i=startElement;i<(theform.elements.length-endElement);i+=1)
{if(theform.elements[i].checked==true)
{flag=1;if(confirm("Are you sure you want to "+message+" this record(s)?"))
return true;else
return false;}}
if(flag==0)
{alert("Please select the checkbox before pressing the "+message+" button.");return false;}}
function CheckDate(theform,dd,mm,yy)
{day1=parseInt(eval("theform."+dd+".options[theform."+dd+".selectedIndex].value"));month1=eval("theform."+mm+".options[theform."+mm+".selectedIndex].value");month1=parseInt(month1-1);year1=parseInt(eval("theform."+yy+".options[theform."+yy+".selectedIndex].value"));if(day1==0&&month1==-1&&year1==0)
{return true;}
var test=new Date(year1,month1,day1);if(!((yearcheck(test.getYear())==year1)&&(month1==test.getMonth())&&(day1==test.getDate())))
{alert("Invalid date");return false;}
return true;}
function CheckDateNew(theform,dd,mm,yy)
{day1=parseInt(eval("theform."+dd+".options[theform."+dd+".selectedIndex].value"));month1=eval("theform."+mm+".options[theform."+mm+".selectedIndex].value");month1=parseInt(month1-1);year1=parseInt(eval("theform."+yy+".options[theform."+yy+".selectedIndex].value"));var test=new Date(year1,month1,day1);var test1=new Date();if(test<test1)
{alert("invalid date");return false;}
if(!((yearcheck(test.getYear())==year1)&&(month1==test.getMonth())&&(day1==test.getDate())))
{alert("Invalid date");return false;}
return true;}
function yearcheck(number)
{if(number<1000)
{number=number+1900;}
return number;}
function empty(object,str)
{var value=trim(object.value);if(value=="")
{alert(str);object.focus();return false;}
str1=trim(object.value);x=0
for(var i=0;i<str1.length;i++)
{if(str1.charAt(i)!=" "){x=1}}
if(x==0)
{alert(str);object.value=""
object.focus();return false;}
str1=trim(object.value);x=0
y=0
len=str1.length;for(var i=0;i<str1.length;i++)
{if((str1.charAt(i)=="\r")&&(str1.charAt(i+1)=="\n")){y++;}}
if(y==(len/2))
{alert(str);object.value=""
object.focus();return false;}
return true;}
var dFilterStep
function dFilterStrip(dFilterTemp,dFilterMask)
{dFilterMask=replace(dFilterMask,'#','');for(dFilterStep=0;dFilterStep<dFilterMask.length++;dFilterStep++)
{dFilterTemp=replace(dFilterTemp,dFilterMask.substring(dFilterStep,dFilterStep+1),'');}
return dFilterTemp;}
function dFilterMax(dFilterMask)
{dFilterTemp=dFilterMask;for(dFilterStep=0;dFilterStep<(dFilterMask.length+1);dFilterStep++)
{if(dFilterMask.charAt(dFilterStep)!='#')
{dFilterTemp=replace(dFilterTemp,dFilterMask.charAt(dFilterStep),'');}}
return dFilterTemp.length;}
function dFilter(key,textbox,dFilterMask)
{dFilterNum=dFilterStrip(textbox.value,dFilterMask);if(key==9)
{return true;}
else if(key==8&&dFilterNum.length!=0)
{dFilterNum=dFilterNum.substring(0,dFilterNum.length-1);}
else if(((key>47&&key<58)||(key>95&&key<106))&&dFilterNum.length<dFilterMax(dFilterMask))
{dFilterNum=dFilterNum+String.fromCharCode(key);}
var dFilterFinal='';for(dFilterStep=0;dFilterStep<dFilterMask.length;dFilterStep++)
{if(dFilterMask.charAt(dFilterStep)=='#')
{if(dFilterNum.length!=0)
{dFilterFinal=dFilterFinal+dFilterNum.charAt(0);dFilterNum=dFilterNum.substring(1,dFilterNum.length);}
else
{dFilterFinal=dFilterFinal+"";}}
else if(dFilterMask.charAt(dFilterStep)!='#')
{dFilterFinal=dFilterFinal+dFilterMask.charAt(dFilterStep);}}
textbox.value=dFilterFinal;return false;}
function replace(fullString,text,by){var strLength=fullString.length,txtLength=text.length;if((strLength==0)||(txtLength==0))return fullString;var i=fullString.indexOf(text);if((!i)&&(text!=fullString.substring(0,txtLength)))return fullString;if(i==-1)return fullString;var newstr=fullString.substring(0,i)+by;if(i+txtLength<strLength)
newstr+=replace(fullString.substring(i+txtLength,strLength),text,by);return newstr;}
function empty(object,str)
{var value=trim(object.value);if(value=="")
{alert(str);object.focus();return false;}
str1=trim(object.value);x=0;for(var i=0;i<str1.length;i++)
{if(str1.charAt(i)!=" "){x=1}}
if(x==0)
{alert(str);object.value="";object.focus();return false;}
str1=trim(object.value);x=0;y=0;len=str1.length;for(var i=0;i<str1.length;i++)
{if((str1.charAt(i)=="\r")&&(str1.charAt(i+1)=="\n")){y++;}}
if(y==(len/2))
{alert(str);object.value="";object.focus();return false;}
return true;}
function FillPhone(theform,txtBox1,txtBox2,txtBox3,$msg)
{var len=theform.xtBox1.value.length+theform.txtBox2.value.length+theform.txtBox3.value.length;if(theform.txtBox1.value.length>=1&&theform.txtBox1.value.length<3)
{alert($msg);theform.txtBox1.focus();return false}
if(theform.txtBox2.value.length>=1&&theform.txtBox2.value.length<3)
{alert($msg);theform.txtBox2.focus();return false}
if(theform.txtBox3.value.length>=1&&theform.txtBox3.value.length<4)
{alert($msg);theform.txtBox3.focus();return false}
if(len>=1&&len<10)
{alert($msg);theform.txtBox1.focus();return false}
return true;}
function LeapYear(year)
{if(((year%4==0)&&(year%100!=0))||(year%400==0))return true;else return false;}
function okForm(monthField,myday,mymonth,myyear)
{if(mymonth=="Jan")
{mymonth=1;}
if(mymonth=="Feb")
{mymonth=2;}
if(mymonth=="Mar")
{mymonth=3;}
if(mymonth=="Apr")
{mymonth=4;}
if(mymonth=="May")
{mymonth=5;}
if(mymonth=="Jun")
{mymonth=6;}
if(mymonth=="Jul")
{mymonth=7;}
if(mymonth=="Aug")
{mymonth=8;}
if(mymonth=="Sep")
{mymonth=9;}
if(mymonth=="Oct")
{mymonth=10;}
if(mymonth=="Nov")
{mymonth=11;}
if(mymonth=="Dec")
{mymonth=12;}
if(myday>31){alert("The maximum number of days in a month is 31.");if(!monthField=='')
monthField.focus();return false;}
if((mymonth==4)||(mymonth==6)||(mymonth==9)||(mymonth==11)){if(myday>30){alert("There are only 30 days in the month that you have selected");if(!monthField=='')
monthField.focus();return false;}}
if(!LeapYear(myyear)&&(mymonth==2)&&(myday>28)){alert("There are only 28 days in February, "+myyear);if(!monthField=='')
monthField.focus();return false;}
if((mymonth==2)&&(myday>29)){alert("The maximum number of days in February is 29.");if(!monthField=='')
monthField.focus();return false;}
return true;}
function checkQuantity(theform)
{if(isNaN(trim(theform.txtQuantity.value)))
{alert("Please enter Numeric values only.");theform.txtQuantity.focus();return false;}
if(theform.txtQuantity.value==''||theform.txtQuantity.value<1)
{alert("Please enter Quantity.");theform.txtQuantity.focus();return false;}}
function checkQuick(theform)
{if(theform.item.value=='')
{alert("Please enter Part Number");theform.item.focus();return false;}
if(isNaN(trim(theform.txtQuantity.value)))
{alert("Please enter Numeric values only.");theform.txtQuantity.focus();return false;}
if(theform.txtQuantity.value==''||theform.txtQuantity.value<1)
{alert("Please enter Quantity.");theform.txtQuantity.focus();return false;}};var cssdropdown={disappeardelay:12000,enablereveal:[true,5],enableiframeshim:1,dropmenuobj:null,asscmenuitem:null,domsupport:document.all||document.getElementById,standardbody:null,iframeshimadded:false,revealtimers:{},getposOffset:function(what,offsettype){var totaloffset=(offsettype=="left")?what.offsetLeft:what.offsetTop;var parentEl=what.offsetParent;while(parentEl!=null){totaloffset=(offsettype=="left")?totaloffset+parentEl.offsetLeft:totaloffset+parentEl.offsetTop;parentEl=parentEl.offsetParent;}
return totaloffset;},css:function(el,targetclass,action){var needle=new RegExp("(^|\\s+)"+targetclass+"($|\\s+)","ig")
if(action=="check")
return needle.test(el.className)
else if(action=="remove")
el.className=el.className.replace(needle,"")
else if(action=="add"&&!needle.test(el.className))
el.className+=" "+targetclass},showmenu:function(dropmenu,e){if(this.enablereveal[0]){if(!dropmenu._trueheight||dropmenu._trueheight<10)
dropmenu._trueheight=dropmenu.offsetHeight
clearTimeout(this.revealtimers[dropmenu.id])
dropmenu.style.height=dropmenu._curheight=0
dropmenu.style.overflow="hidden"
dropmenu.style.visibility="visible"
this.revealtimers[dropmenu.id]=setInterval(function(){cssdropdown.revealmenu(dropmenu)},10)}
else{dropmenu.style.visibility="visible"}
this.css(this.asscmenuitem,"selected","add")},revealmenu:function(dropmenu,dir){var curH=dropmenu._curheight,maxH=dropmenu._trueheight,steps=this.enablereveal[1]
if(curH<maxH){var newH=Math.min(curH,maxH)
dropmenu.style.height=newH+"px"
dropmenu._curheight=newH+Math.round((maxH-newH)/steps)+1}
else{dropmenu.style.height="auto"
dropmenu.style.overflow="hidden"
clearInterval(this.revealtimers[dropmenu.id])}},clearbrowseredge:function(obj,whichedge){var edgeoffset=0
if(whichedge=="rightedge"){var windowedge=document.all&&!window.opera?this.standardbody.scrollLeft+this.standardbody.clientWidth-15:window.pageXOffset+window.innerWidth-15
var dropmenuW=this.dropmenuobj.offsetWidth
if(windowedge-this.dropmenuobj.x<dropmenuW)
edgeoffset=dropmenuW-obj.offsetWidth}
else{var topedge=document.all&&!window.opera?this.standardbody.scrollTop:window.pageYOffset
var windowedge=document.all&&!window.opera?this.standardbody.scrollTop+this.standardbody.clientHeight-15:window.pageYOffset+window.innerHeight-18
var dropmenuH=this.dropmenuobj._trueheight
if(windowedge-this.dropmenuobj.y<dropmenuH){edgeoffset=dropmenuH+obj.offsetHeight
if((this.dropmenuobj.y-topedge)<dropmenuH)
edgeoffset=this.dropmenuobj.y+obj.offsetHeight-topedge}}
return edgeoffset},dropit:function(obj,e,dropmenuID){if(this.dropmenuobj!=null)
this.hidemenu()
this.clearhidemenu()
this.dropmenuobj=document.getElementById(dropmenuID)
this.asscmenuitem=obj
this.showmenu(this.dropmenuobj,e)
this.dropmenuobj.x=this.getposOffset(obj,"left")
this.dropmenuobj.y=this.getposOffset(obj,"top")
this.dropmenuobj.style.left=this.dropmenuobj.x-this.clearbrowseredge(obj,"rightedge")+"px"
this.dropmenuobj.style.top=this.dropmenuobj.y-this.clearbrowseredge(obj,"bottomedge")+"px"
this.positionshim()},positionshim:function(){if(this.iframeshimadded){if(this.dropmenuobj.style.visibility=="visible"){this.shimobject.style.width=this.dropmenuobj.offsetWidth+"px"
this.shimobject.style.height=this.dropmenuobj._trueheight+"px"
this.shimobject.style.left=parseInt(this.dropmenuobj.style.left)+"px"
this.shimobject.style.top=parseInt(this.dropmenuobj.style.top)+"px"
this.shimobject.style.display="block"}}},hideshim:function(){if(this.iframeshimadded)
this.shimobject.style.display='none'},isContained:function(m,e){var e=window.event||e
var c=e.relatedTarget||((e.type=="click")?e.fromElement:e.toElement)
while(c&&c!=m)try{c=c.parentNode}catch(e){c=m}
if(c==m)
return true
else
return false},dynamichide:function(m,e){if(!this.isContained(m,e)){this.delayhidemenu()}},delayhidemenu:function(){},hidemenu:function(){this.css(this.asscmenuitem,"selected","remove")
this.dropmenuobj.style.visibility='hidden'
this.dropmenuobj.style.left=this.dropmenuobj.style.top="-1000px"
this.hideshim()},clearhidemenu:function(){if(this.delayhide!="undefined")
clearTimeout(this.delayhide)},addEvent:function(target,functionref,tasktype){if(target.addEventListener)
target.addEventListener(tasktype,functionref,false);else if(target.attachEvent)
target.attachEvent('on'+tasktype,function(){return functionref.call(target,window.event)});},startchrome:function(){if(!this.domsupport)
return
this.standardbody=(document.compatMode=="CSS1Compat")?document.documentElement:document.body
for(var ids=0;ids<arguments.length;ids++){var menuitems=document.getElementById(arguments[ids]).getElementsByTagName("a")
for(var i=0;i<menuitems.length;i++){if(menuitems[i].getAttribute("rel")){var relvalue=menuitems[i].getAttribute("rel")
var asscdropdownmenu=document.getElementById(relvalue)
this.addEvent(asscdropdownmenu,function(){cssdropdown.delayhidemenu()},"click")
try{menuitems[i].innerHTML=menuitems[i].innerHTML}catch(e){}
this.addEvent(menuitems[i],function(e){if(!cssdropdown.isContained(this,e)){var evtobj=window.event||e
cssdropdown.dropit(this,evtobj,this.getAttribute("rel"))}},"click")
this.addEvent(menuitems[i],function(){cssdropdown.delayhidemenu()},"click")}}}
if(this.enableiframeshim&&document.all&&!window.XDomainRequest&&!this.iframeshimadded){document.write('<IFRAME id="iframeshim" src="about:blank" frameBorder="0" scrolling="no" style="left:0; top:0; position:absolute; display:none;z-index:90; background: transparent;"></IFRAME>')
this.shimobject=document.getElementById("iframeshim")
this.shimobject.style.filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)'
this.iframeshimadded=true}}};var message="Copyright www.wiltsgrove.co.uk";function clickIE4(){if(event.button==2){alert(message);return false;}}
function clickNS7(e){if(document.layers||document.getElementById&&!document.all){if(e.which==2||e.which==3){alert(message);return false;}}}
if(document.layers){document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS4;}
else if(document.all&&!document.getElementById){document.onmousedown=clickIE4;}
document.oncontextmenu=new Function("alert(message);return false");function keyDown(e){if(navigator.appName=='Netscape'){if(e.which==17){alert('This action is prohibited');e.cancelBubble=true;return false;}}
if(navigator.appName=='Microsoft Internet Explorer'){if(window.event.keyCode==17){alert('This action is prohibited');window.event.keyCode=0;return false;}}}
document.onkeydown=keyDown;if(navigator.appName=='Netscape')
document.captureEvents(Event.KEYDOWN)
