// ajax


function ajax_getDiv(div_id)
{if(document.getElementById)
{if(document.getElementById(div_id))
{return document.getElementById(div_id);}
else
{return parent.document.getElementById(div_id);}}
else
{if(document.layers)
{if(document.div_id)
{return document.div_id;}
else
{return parent.document.div_id;}}
else
{if(document.all.div_id)
{return document.all.div_id;}
else
{return parent.document.all.div_id;}}}}

function ajax_checkMailInput(input_id,img)
{if(input_id.value.indexOf("@")>0)
{ajax_DisplayLayer(img,true);ajax_getDiv(img).src="img/check2.ico";}
else
{ajax_DisplayLayer(img,true);ajax_getDiv(img).src="img/delete.ico";}}
function ajax_checkZipCodeInput(input_id,img)
{var isZipCode=false;var ZipCode=input_id.value;if((ZipCode.length==6)&&(ZipCode.indexOf(" ")<0))
{isZipCode=true;}
else if((ZipCode.length==7)&&(ZipCode.indexOf(" ")==3))
{isZipCode=true;}
if(isZipCode)
{document.getElementById(img).src="icones/check2.ico";ajax_DisplayLayer(img,true);}
else
{document.getElementById(img).src="icones/delete.ico";ajax_DisplayLayer(img,true);}}

function ajax_updateDiv_Loading(div,href,data)
{ajax_updateDiv(div,href,data);}
function ajax_updateDivNoRedirection(div,href,data)
{var xhr_link="";var xhr_object=null;var position=div;if(window.XMLHttpRequest)xhr_object=new XMLHttpRequest();else
if(window.ActiveXObject)xhr_object=new ActiveXObject("Microsoft.XMLHTTP");if(data=="")
{xhr_link=href;}
else
{xhr_link=href+'?'+data;}
xhr_object.open("GET",xhr_link,true);xhr_object.onreadystatechange=function(){if(xhr_object.readyState==4)
{ajax_putDiv(div,xhr_object.responseText);}}
xhr_object.send(null);}
function ajax_updateDiv(div,href,data,refreshpage)
{var xhr_link="";var xhr_object=null;var position=div;if(window.XMLHttpRequest)xhr_object=new XMLHttpRequest();else
if(window.ActiveXObject)xhr_object=new ActiveXObject("Microsoft.XMLHTTP");if(data=="")
{xhr_link=href;}
else
{xhr_link=href+'?'+data;}
xhr_object.open("GET",xhr_link,true);xhr_object.onreadystatechange=function(){if(xhr_object.readyState==4)
{ajax_putDiv(div,xhr_object.responseText);if(refreshpage!="")
{var sURL=unescape(window.location.pathname);window.location.href=refreshpage;}}}
xhr_object.send(null);}

function ajax_putDiv(div,content)
{if(document.getElementById)
{if(document.getElementById(div))
{document.getElementById(div).innerHTML=content;}
else
{parent.document.getElementById(div).innerHTML=content;}}
else
{if(document.layers)
{if(document.div)
{document.div.innerHTML=content;}
else
{parent.document.div.innerHTML=content;}}
else
{if(document.all.div)
{document.all.div.innerHTML=content;}
else
{parent.document.all.div.innerHTML=content;}}}}

function ajax_DisplayDiv(item)
{obj=ajax_getDiv(item);if(obj)
{if(obj.style.display=="none")
{obj.style.display="block";}
else
{obj.style.display="none";}}}

function ajax_DisplayLayer(item,display)
{obj=ajax_getDiv(item);if(obj)
{if(display)
{obj.style.display="block";}
else
{obj.style.display="none";}}}

function ajax_DisplayImage(item,display)
{if(obj)
{if(display)
{obj.style.display="block";}
else
{obj.style.display="none";}}}

function showBox(){ajax_getDiv('overlay').display="block";center('box');return false;}
function hideBox(){ajax_getDiv('box').display="none";ajax_getDiv('overlay').display="none";return false;}
//reflection

if(!document.myGetElementsByClassName){document.myGetElementsByClassName=function(className){var children=document.getElementsByTagName('*')||document.all;var elements=new Array();for(var i=0;i<children.length;i++){var child=children[i];var classNames=child.className.split(' ');for(var j=0;j<classNames.length;j++){if(classNames[j]==className){elements.push(child);break;}}}
return elements;}}
var Reflection={defaultHeight:0.5,defaultOpacity:0.5,add:function(image,options){Reflection.remove(image);doptions={"height":Reflection.defaultHeight,"opacity":Reflection.defaultOpacity}
if(options){for(var i in doptions){if(!options[i]){options[i]=doptions[i];}}}else{options=doptions;}
try{var d=document.createElement('div');var p=image;var classes=p.className.split(' ');var newClasses='';for(j=0;j<classes.length;j++){if(classes[j]!="reflect"){if(newClasses){newClasses+=' '}
newClasses+=classes[j];}}
var reflectionHeight=Math.floor(p.height*options['height']);var divHeight=Math.floor(p.height*(1+options['height']));var reflectionWidth=p.width;if(document.all&&!window.opera){if(p.parentElement.tagName=='A'){var d=document.createElement('a');d.href=p.parentElement.href;}
d.className=newClasses;p.className='reflected';d.style.cssText=p.style.cssText;p.style.cssText='vertical-align: bottom';var reflection=document.createElement('img');reflection.src=p.src;reflection.style.width=reflectionWidth+'px';reflection.style.display='block';reflection.style.height=p.height+"px";reflection.style.marginBottom="-"+(p.height-reflectionHeight)+'px';reflection.style.filter='flipv progid:DXImageTransform.Microsoft.Alpha(opacity='+(options['opacity']*100)+', style=1, finishOpacity=0, startx=0, starty=0, finishx=0, finishy='+(options['height']*100)+')';d.style.width=reflectionWidth+'px';d.style.height=divHeight+'px';p.parentNode.replaceChild(d,p);d.appendChild(p);d.appendChild(reflection);}else{var canvas=document.createElement('canvas');if(canvas.getContext){d.className=newClasses;p.className='reflected';d.style.cssText=p.style.cssText;p.style.cssText='vertical-align: bottom';var context=canvas.getContext("2d");canvas.style.height=reflectionHeight+'px';canvas.style.width=reflectionWidth+'px';canvas.height=reflectionHeight;canvas.width=reflectionWidth;d.style.width=reflectionWidth+'px';d.style.height=divHeight+'px';p.parentNode.replaceChild(d,p);d.appendChild(p);d.appendChild(canvas);context.save();context.translate(0,image.height-1);context.scale(1,-1);context.drawImage(image,0,0,reflectionWidth,image.height);context.restore();context.globalCompositeOperation="destination-out";var gradient=context.createLinearGradient(0,0,0,reflectionHeight);gradient.addColorStop(1,"rgba(255, 255, 255, 1.0)");gradient.addColorStop(0,"rgba(255, 255, 255, "+(1-options['opacity'])+")");context.fillStyle=gradient;context.rect(0,0,reflectionWidth,reflectionHeight*2);context.fill();}}}catch(e){}},remove:function(image){if(image.className=="reflected"){image.className=image.parentNode.className;image.parentNode.parentNode.replaceChild(image,image.parentNode);}}}
function addReflections(){var rimages=document.myGetElementsByClassName('reflect');for(i=0;i<rimages.length;i++){var rheight=null;var ropacity=null;var classes=rimages[i].className.split(' ');for(j=0;j<classes.length;j++){if(classes[j].indexOf("rheight")==0){var rheight=classes[j].substring(7)/100;}else if(classes[j].indexOf("ropacity")==0){var ropacity=classes[j].substring(8)/100;}}
Reflection.add(rimages[i],{height:rheight,opacity:ropacity});}}
var previousOnload=window.onload;window.onload=function(){if(previousOnload)previousOnload();addReflections();}
//rating

function getElement(element)
{return document.getElementById(element);}
function curry(fn,scope)
{var scope=scope||window;var args=Array.prototype.slice.call(arguments,2)||[];return function()
{fn.apply(scope,args);};}
var rating=function(id,value)
{this.construct.apply(this,arguments);};rating.prototype={construct:function(id,stars,value,rerate,hinput)
{this.id=id;this.imageOff='blank';this.imageOn='mouseOn';this.imageOut='mouseOff';this.stars=stars;this.rerate=rerate;this.hinput=hinput;this.setValue(value);this.el=getElement(id);for(i=1;i<=this.stars;i++)
{var starID='star'+i;var newstar=document.createElement('span');newstar.id=starID;newstar.className=this.imageOff;this.el.appendChild(newstar);this.addListener(getElement(starID),"mouseover",curry(this.mouseOver,this,i));this.addListener(getElement(starID),"click",curry(this.clickMethod,this,i));}
this.addListener(this.el,"mouseout",curry(this.mouseOut,this));this.renderStars(this.value,false);},addListener:function(element,type,expression,bubbling)
{bubbling=bubbling||false;if(window.addEventListener)
{element.addEventListener(type,expression,bubbling);return true;}
else if(window.attachEvent)
{element.attachEvent('on'+type,expression);return true;}
else
{return false;}},removeListener:function(element,type,expression,bubbling)
{bubbling=bubbling||false;if(window.removeEventListener)
{element.removeEventListener(type,expression,bubbling);return true;}
else if(window.removeEvent)
{element.removeEvent('on'+type,expression);return true;}
else
{return false;}},mouseOver:function(rating)
{if(this.rerate)
{this.renderStars(rating,true);}},clickMethod:function(rating)
{this.onClick(rating);},mouseOut:function()
{if(this.rerate)
{if(this.value==0||this.value=='')
{this.renderStars(0,false);}
else
{this.renderStars(this.value,false);}}},renderStars:function(units,startColor)
{if(units>0)
{for(var i=1;i<=units;i++)
{if(startColor==true)
{getElement("star"+i).className=this.imageOn;}
else
{getElement("star"+i).className=this.imageOut;}}
for(i=parseInt(units)+1;i<=this.stars;i++)
{getElement("star"+i).className=this.imageOff;}}
else
{for(i=1;i<=this.stars;i++)
{getElement("star"+i).className=this.imageOff;}}},onClick:function(value)
{this.setValue(value);getElement(this.hinput).value=this.value;if(!this.rerate)
{for(i=1;i<=this.stars;i++)
{this.removeListener(getElement('star'+i),"mouseover");this.removeListener(getElement('star'+i),"click");}
this.removeListener(getElement(this.id),"mouseout");this.renderStars(this.value,false);}},setValue:function(value)
{this.value=value;},getValue:function()
{return this.value;}}
// bar bottom


