var OMCHAT_KEYCODE_ENTER=13;var OMCHAT_KEYCODE_ESCAPE=27;var OMCHAT_KEYCODE_TAB=9;var OMCHAT_KEYCODE_BACKSPACE=8;var OMCHAT_KEYCODE_ARROW_UP=38;var OMCHAT_KEYCODE_ARROW_DOWN=40;function getElement(id)
{var r=document.all?document.all[id]:document.getElementById(id);return r==null?new Object():r;}
function getNodeValue(p_item,tagname)
{if(!p_item)return'';var ret='';var it=p_item.getElementsByTagName(tagname);var ret_firstChild=null;if(it.length>0)
ret_firstChild=it.item(0).firstChild;if(ret_firstChild!=null)ret=ret_firstChild.nodeValue;return ret;}
function get_pos(em)
{for(var lx=0,ly=0;em!=null;lx+=em.offsetLeft,ly+=em.offsetTop,em=em.offsetParent);return{top:ly,left:lx};}
function getPageDimensions()
{var x,y;if(self.innerHeight)
{x=self.innerWidth;y=self.innerHeight;}
else if(document.documentElement&&document.documentElement.clientHeight)
{x=document.documentElement.clientWidth;y=document.documentElement.clientHeight;}
else if(document.body)
{x=document.body.clientWidth;y=document.body.clientHeight;}
return{height:y,width:x};}
function setLocation(url)
{location.href=url;}
function toggleDisplay(emid)
{var em=getElement(emid);if(em.style.display=='none')em.style.display='block';else em.style.display='none';}
function toggleDisplay_andText(emid,button,text_do,text_undo)
{var em=getElement(emid);if(em.style.display=='none'){em.style.display='block';button.innerHTML=text_undo;}
else{em.style.display='none';button.innerHTML=text_do;}}
function inputShowHide_OnFocus(input,text)
{if(input.value==text)
{input.value='';input.style.color='#000';}}
function inputShowHide_OnBlur(input,text)
{if(input.value.length==0)
{input.style.color='#777';input.value=text;}}
function PageQuery(q)
{if(q.length>1)this.q=q.substring(1,q.length);else this.q=null;this.keyValuePairs=new Array();if(q)
{for(var i=0;i<this.q.split('&').length;i++)
{this.keyValuePairs[i]=this.q.split('&')[i];}}
this.getKeyValuePairs=function(){return this.keyValuePairs;}
this.getValue=function(s)
{for(var j=0;j<this.keyValuePairs.length;j++)
{if(this.keyValuePairs[j].split('=')[0]==s)
return this.keyValuePairs[j].split('=')[1];}
return false;}
this.getParameters=function()
{var a=new Array(this.getLength());for(var j=0;j<this.keyValuePairs.length;j++)
{a[j]=this.keyValuePairs[j].split('=')[0];}
return a;}
this.getLength=function(){return this.keyValuePairs.length;}}
function queryString(url,key)
{var page=new PageQuery(queryString_get_query_from_url(url));return unescape(page.getValue(key));}
function queryString_get_add_q_or_amp(url)
{var pq=new PageQuery(queryString_get_query_from_url(url));if(pq.getKeyValuePairs().length>0)
return'&';else
return'?';}
function queryString_get_query_from_url(url)
{if(url.indexOf('?')!=-1)
return url.substring(url.indexOf('?'));else
return'';}
function AttachEvent(obj,evt,fnc,useCapture){if(!useCapture)useCapture=false;if(obj.addEventListener){obj.addEventListener(evt,fnc,useCapture);return true;}else if(obj.attachEvent)return obj.attachEvent("on"+evt,fnc);else{MyAttachEvent(obj,evt,fnc);obj['on'+evt]=function(){MyFireEvent(obj,evt)};}}
function MyAttachEvent(obj,evt,fnc){if(!obj.myEvents)obj.myEvents={};if(!obj.myEvents[evt])obj.myEvents[evt]=[];var evts=obj.myEvents[evt];evts[evts.length]=fnc;}
function MyFireEvent(obj,evt){if(!obj||!obj.myEvents||!obj.myEvents[evt])return;var evts=obj.myEvents[evt];for(var i=0,len=evts.length;i<len;i++)evts[i]();}
function email_valid(email)
{return email.match(new RegExp('^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{1,4})+$'));}
sfHover=function(){var sfEm=document.getElementById("nav");if(sfEm!=null)
{var sfEls=sfEm.getElementsByTagName("LI");for(var i=0;i<sfEls.length;i++){sfEls[i].onmouseover=function(){this.className+="sfhover";}
sfEls[i].onmouseout=function(){this.className=this.className.replace(new RegExp("sfhover\\b"),"");}}}}
if(window.attachEvent)window.attachEvent("onload",sfHover);
function user_action_items_mark_read(userid,item_type,type_refid,refid)
{xmlhttp_request('/CMS/php/xml_db_items_mark_read.php','userid='+userid+'&item_type='+item_type+'&type_refid='+type_refid+'&refid='+refid,'POST',xmlhttp_processxml,xmlhttp_error,true,true);}
function nav_pages_changeblocks(maxpages_atatime,changetype,npages,npage,suburi,exec_fn,id_prefix)
{var firstvalue=parseInt(document.getElementById(id_prefix+'pages_block1').innerHTML);if(changetype=='back')
{firstvalue-=maxpages_atatime;}
var arrow_forward=document.getElementById(id_prefix+'pages_forwardarrow');var arrow_back=document.getElementById(id_prefix+'pages_backarrow');for(var i=firstvalue;i<firstvalue+maxpages_atatime;i++)
{var em=document.getElementById(id_prefix+'pages_block'+(i-firstvalue+1));var page=parseInt(em.innerHTML);if(changetype=='forward')
{em.innerHTML=page+maxpages_atatime;nav_pages_block_out(arrow_back);arrow_back.style.display='block';if(i==npages-maxpages_atatime)
{arrow_forward.style.display='none';}}
else
{em.innerHTML=page-maxpages_atatime;arrow_forward.style.display='block';nav_pages_block_out(arrow_forward);if(i==1)
{arrow_back.style.display='none';}}
if(i+maxpages_atatime>npages&&changetype=='forward')
em.style.display='none';else
em.style.display='block';var emvalue=parseInt(em.innerHTML);if(emvalue==npage)
{em.className='pages_selected';nav_pages_block_clear(em);em.onmouseover=function(){}
em.onmouseout=function(){}
em.onclick=function(){}}
else
{if(parseInt(emvalue)<1)
{em.style.display='none';}
else
{em.className='pages_block';if(emvalue=='1')
em.href=suburi.replace('page','');else
em.href=suburi+emvalue;nav_pages_block_out(em);}}}}
function nav_pages_block_hover_closure(em)
{return function(){nav_pages_block_hover(em);}}
function nav_pages_block_out_closure(em)
{return function(){em.className='pages_block';}}
function nav_pages_onclick_closure(loc)
{return function(){nav_pages_onclick(loc);}}
function nav_pages_onclick(loc)
{location.href=loc;}
function nav_pages_block_hover(em)
{em.className='pages_block_hover';}
function nav_pages_block_out(em)
{em.className='pages_block';}
function nav_pages_block_clear(em)
{}
var OMCHAT_DESCRIPTION_DELAY=400;var omchat_description_timer;function omchat_form_description_hover_delayed(em,description)
{omchat_description_timer=setTimeout(function(){omchat_form_description_hover(em,description);},OMCHAT_DESCRIPTION_DELAY);}
function omchat_form_description_hover(em,description)
{clearTimeout(omchat_description_timer);omchat_description_timer=null;if(description.length==0)return;var popup=document.createElement('div');popup.className='omchat_tidbit_popup_nowidth';popup.id='omchat_tidbit_popup_div';var pos=get_pos(em);popup.appendChild(document.createTextNode(description));popup.style.left=(pos.left+em.offsetWidth+7)+'px';popup.style.top=(pos.top+1)+'px';document.body.appendChild(popup);if(!(pos.left+em.offsetWidth+1+popup.offsetWidth<document.body.clientWidth))
{popup.style.left=(pos.left-popup.offsetWidth-14)+'px';popup.style.top=(pos.top+1)+'px';}}
function omchat_form_description_above_hover_delayed(em,description)
{omchat_description_timer=setTimeout(function(){omchat_form_description_above_hover(em,description);},OMCHAT_DESCRIPTION_DELAY);}
function omchat_form_description_above_hover(em,description)
{clearTimeout(omchat_description_timer);omchat_description_timer=null;if(description.length==0)return;var popup=document.createElement('div');popup.className='omchat_tidbit_popup_nowidth';popup.id='omchat_tidbit_popup_div';var pos=get_pos(em);popup.appendChild(document.createTextNode(description));popup.style.display='block';popup.style.top=(pos.top-popup.clientHeight+em.offsetHeight-2)+'px';popup.style.left=(pos.left+em.offsetWidth+10)+'px';document.body.appendChild(popup);}
function omchat_form_description_above_hover_closure(description)
{return function(){omchat_form_description_above_hover_delayed(this,description);}}
function omchat_form_description_out()
{clearTimeout(omchat_description_timer);omchat_description_timer=null;var popup1=document.getElementById('omchat_tidbit_popup_div');var popup2=document.getElementById('omchat_tidbit_popup_div_fixedwidth');if(popup1!=null)document.body.removeChild(popup1);if(popup2!=null)document.body.removeChild(popup2);}
function omchat_form_fielddescription_hover(em,description,fixedwidth)
{if(description.length==0)return;var popup=document.createElement('div');if(fixedwidth)
{popup.className='omchat_tidbit_popup';popup.id='omchat_tidbit_popup_div_fixedwidth';}
else
{popup.className='omchat_tidbit_popup_nowidth';popup.id='omchat_tidbit_popup_div';}
var pos=get_pos(em);popup.appendChild(document.createTextNode(description));popup.style.top=(pos.top+em.offsetHeight+1)+'px';popup.style.left=(pos.left)+'px';document.body.appendChild(popup);}
function omchat_form_textarea_tag_onclick(emid,tagtype)
{var join_on=tag_get_tags_from_checkboxes('omchat_category_tag_content_type');var tags=getElement(emid).value;omchat_floatwindow_showhide('omchat_tags_browse_div'+tagtype,getElement('omchat_tags_browse_div'+tagtype+'_close'));if(join_on.length>0)
{omchat_tag_span_onclick('',true,tagtype,emid)}}
function form_submit_enable_set(formid,enabled)
{getElement('omchat_'+formid+'_submit').disabled=!enabled;}
function form_price_get(em_id,progress_em)
{var price,price_cents;price=getElement(em_id).value;if(price.indexOf('.')!=-1)
{price_cents=price.substr(price.indexOf('.')+1);if(price_cents>=100)
{progress_em.innerHTML='Invalid price.';return'';}
else
{price=price.substr(0,price.indexOf('.'));}}
else price_cents=0;if(price.length>0)
{price=price.replace(/[^\d]/g,'');if(isNaN(price=parseInt(price))||isNaN(price_cents=parseInt(price_cents)))
{progress_em.innerHTML='Invalid price.';return false;}
return(price*100)+price_cents;}
else return'';}
function form_textbox_maximize(emid,icon_em)
{var em=getElement(emid);em.className='form_text_area_largest_fixed';icon_em.src='/CMS/images/icon_restore.gif';icon_em.onclick=function(){form_textbox_restore(emid,icon_em);}
icon_em.onmouseover=function(){omchat_form_fielddescription_hover(em,'Contract this textbox',true);}}
function form_textbox_restore(emid,icon_em)
{var em=getElement(emid);em.className='form_text_area';icon_em.src='/CMS/images/icon_maximize.gif';icon_em.onclick=function(){form_textbox_maximize(emid,icon_em);}
icon_em.onmouseover=function(){omchat_form_fielddescription_hover(em,'Expand this textbox',true);}}
function xmlhttp_connect()
{var xmlhttp,bComplete=false;try{xmlhttp=new ActiveXObject('Msxml2.XMLHTTP');}
catch(e){try{xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');}
catch(e){try{xmlhttp=new XMLHttpRequest();}
catch(e){xmlhttp=false;}}}
if(!xmlhttp)return null;this.connect=function(sURL,sVars,sMethod,fnDone,sReturnXML,sbAsynchronous)
{if(!xmlhttp)return false;bComplete=false;sMethod=sMethod.toUpperCase();try{if(sMethod=='GET')
{xmlhttp.open(sMethod,sURL+'?'+sVars,sbAsynchronous);sVars='';}
else
{xmlhttp.open(sMethod,sURL,sbAsynchronous);xmlhttp.setRequestHeader('Method','POST '+sURL+' HTTP/1.1');xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');}
xmlhttp.onreadystatechange=function()
{if(xmlhttp.readyState==4&&!bComplete)
{bComplete=true;if(sReturnXML)
fnDone(xmlhttp.responseXML);else
fnDone(xmlhttp.responseText);}};xmlhttp.send(sVars);}
catch(z){return false;}
return true;};return this;}
function xmlhttp_request(url,params,request_method,callback_function,error_function,return_xml,bAsynchronous)
{var myConn=new xmlhttp_connect();if(!myConn)error_function();else myConn.connect(url,params,request_method,callback_function,return_xml,bAsynchronous);}
function xmlhttp_error(errorcode)
{alert('An error occurred. Please refresh the page. (press F5)');}
function xmlhttp_processxml(xml)
{}
function xmlhttp_processxml_msg_only(xml)
{var items=xml.documentElement.getElementsByTagName('item');var msg=getNodeValue(items.item(0),'msg');var form_id=getNodeValue(items.item(0),'form_id');var div_hide_id=getNodeValue(items.item(0),'div_hide_id');var progress_em,submit_em;var progress_em_id='omchat_'+form_id+'_progress';var submit_em_id='omchat_'+form_id+'_submit';if((progress_em=document.getElementById(progress_em_id))!=null)
progress_em.innerHTML=msg;if((submit_em=document.getElementById(submit_em_id))!=null)
submit_em.disabled=false;if(div_hide_id.length>0)getElement(div_hide_id).style.display='none';}
function xmlhttp_getNodeValue(p_item,tagname)
{if(!p_item)return'';var ret='';var it=p_item.getElementsByTagName(tagname);var ret_firstChild=null;if(it.length>0)
ret_firstChild=it.item(0).firstChild;if(ret_firstChild!=null)ret=ret_firstChild.nodeValue;return ret;}
function omchat_preload_images()
{var images=new Array('button_edit.gif','button_edit2.gif','button_change.gif','button_change2.gif');var images_arr=new Array();for(var i=0;i<images.length;i++)
{images_arr[i]=document.createElement('img');images_arr[i].setAttribute('src','/CMS/images/'+images[i]);}}
function omchat_onload(bSaveGMTOffset,em_id_to_follow_scrollbar,initRightClick)
{omchat_preload_images();if(initRightClick)
RightClick.init();if(screen.width<=800)
{var new_width=777;var body_width_old=document.body.clientWidth;document.body.style.width=new_width+'px';getElement('4').style.width=new_width+'px';var content_main=document.getElementById('content_main');if(content_main!=null)
{var content_main_width_old=content_main.style.width.replace(/px/,'');content_main.style.width=(new_width-(body_width_old-content_main_width_old))+'px';}}
if(bSaveGMTOffset)
{var date_now=new Date();var offset=date_now.getTimezoneOffset();xmlhttp_request('/CMS/php/xml_GMT_offset_save.php','offset='+offset,'POST',xmlhttp_processxml,xmlhttp_error,true,true);}
if(em_id_to_follow_scrollbar.length>0)
window.onscroll=function(){scrollToScrollbar(em_id_to_follow_scrollbar);}
var a_links=document.getElementsByTagName('a');for(var i=0;i<a_links.length;i++)
if(a_links[i].getAttribute('rel')=='external')
a_links[i].target='_blank';var win_float;if((win_float=document.getElementById('omchat_window_float_terms'))!=null)
window_float_show(win_float);if((win_float=document.getElementById('omchat_window_float_site_status'))!=null)
window_float_show(win_float);if(document.all&&document.getElementById)
{var ul_ems=document.getElementsByTagName('ul');for(var j=0;j<ul_ems.length;j++)
{if(ul_ems[j].className=='popup')
{for(i=0;i<ul_ems[j].childNodes.length;i++)
{node=ul_ems[j].childNodes[i];if(node.nodeName=="LI")
{node.onmouseover=function()
{this.className+=" over";}
node.onmouseout=function()
{this.className=this.className.replace(" over","");}}}}}}}
function scrollToTop()
{if((document.documentElement)&&(document.documentElement.scrollTop||document.documentElement.scrollTop==0))
document.documentElement.scrollTop=0;else if(document.body)
document.body.scrollTop=0;}
function scrollToBottom()
{if((document.documentElement)&&(document.documentElement.scrollTop||document.documentElement.scrollTop==0))
document.documentElement.scrollTop=document.body.scrollHeight;else if(document.body)
document.body.scrollTop=document.body.scrollHeight;}
function getScrollTop()
{if((document.documentElement)&&(document.documentElement.scrollTop||document.documentElement.scrollTop==0))
return document.documentElement.scrollTop;else
return document.body.scrollTop;}
function setScrollTop(top)
{if((document.documentElement)&&(document.documentElement.scrollTop||document.documentElement.scrollTop==0))
document.documentElement.scrollTop=top;else if(document.body)
document.body.scrollTop=top;}
function scrollToView(top,em_height)
{var page_dimensions=getPageDimensions();var dif=Math.abs(top-getScrollTop());if((dif+em_height)>page_dimensions.height)
{var extra=em_height+50-Math.abs(page_dimensions.height-Math.abs(getScrollTop()-top));setScrollTop(getScrollTop()+extra);}}
function scrollToScrollbar(em_id)
{var em=getElement(em_id);em.style.top=getScrollTop()+(document.documentElement.clientHeight/2)-(em.clientHeight)+10+'px';}
var AlphaOpacity={isSupported:null,isInitiated:false,_isIE:false,_property:null,_regExpGet:null,_regExpSet:null,initiate:function(oNode){this.isSupported=true;if(typeof oNode.style.MozOpacity!="undefined"){this._property="MozOpacity";}else if(typeof oNode.style.opacity!="undefined"){this._property="opacity";}else if(typeof oNode.style.KhtmlOpacity!="undefined"){this._property="KhtmlOpacity";}else if(typeof oNode.style.filter!="undefined"){this._property="filter";this._isIE=true;this._regExpGet=/.*opacity=([0-9]+).*/;this._regExpSet=/(.*opacity=)[0-9]+(.*)/;}else{this.isSupported=false;}
this.isInitiated=true;},set:function(oNode,nValue){if(!this.isInitiated){this.initiate(oNode);}
if(!this.isSupported){return null;}
nValue=Math.round(nValue);if(!this._isIE){oNode.style[this._property]=nValue/100;return nValue;}else if(this.get(oNode)!=null){oNode.style[this._property]=(oNode.currentStyle?oNode.currentStyle[this._property]:oNode.style[this._property]).replace(this._regExpSet,"$1"+nValue+"$2");return nValue;}else{oNode.style[this._property]+="alpha(opacity="+nValue+")";return nValue;}
return null;},get:function(oNode){var sStyle;if(!this.isInitiated){this.initiate(oNode);}
if(!this.isSupported){return null;}
sStyle=document.defaultView?document.defaultView.getComputedStyle(oNode,null)[this._property]:oNode.currentStyle?oNode.currentStyle[this._property]:oNode.style[this._property];if(!this._isIE){return isNaN(sStyle)?null:sStyle*100;}else{return sStyle.match(this._regExpGet)?sStyle.replace(this._regExpGet,"$1"):null;}
return null;}}
function blackness_show(floatwindow)
{var height_extra=0;var floatwindow_top=parseInt(floatwindow.style.top.replace(/(\d+)px/,'$1'));if(getScrollTop()+getPageDimensions().height<floatwindow_top+floatwindow.clientHeight)
height_extra=(floatwindow_top+floatwindow.clientHeight)-(getScrollTop()+getPageDimensions().height);var black=document.createElement('div');black.id='window_black';black.style.height=(document.body.clientHeight+height_extra)+'px';black.style.width=(document.documentElement.scrollWidth)+'px';document.body.appendChild(black);AlphaOpacity.set(black,35);}
function blackness_hide()
{document.body.removeChild(getElement('window_black'));}
function window_float_showhide(divid)
{var div=getElement(divid);if(div.style.display=='block')
{window_float_hide(divid);return false;}
window_float_show(div);return true;}
function window_float_show(div)
{var content_main=getElement('content_main');var content_center;if((content_center=document.getElementById('content_center'))==null)
content_center=content_main;var content_center_pos=get_pos(content_center);if(content_center_pos.top<getScrollTop()-3)
div.style.top=(getScrollTop()-3)+'px';else
div.style.top=(content_center_pos.top)+'px';div.style.display='block';div.style.left=(content_center_pos.left)+(content_main.clientWidth/2)-(div.clientWidth/2)+'px';window_float_setup(div);blackness_show(div);}
function window_float_setup(div)
{document.onkeydown=function(evt){var e=evt||window.event;if(e.keyCode==27)window_float_hide(div.id);return true;}}
function window_float_hide_closure(divid)
{return function(){window_float_hide(divid);}}
function window_float_hide(divid)
{blackness_hide();var div=getElement(divid);div.style.display='none';}
function window_float_loading_show(divid)
{var div=getElement(divid);while(div.hasChildNodes())div.removeChild(div.lastChild);var p=document.createElement('p');p.className='hello';p.appendChild(document.createTextNode('Loading...'));div.appendChild(p);}
function window_is_hidden(divid)
{var window=document.getElementById(divid);if(window==null)return true;return window.style.display!='block';}
function window_create(id,title)
{var window=document.createElement('div');window.className='window_float';window.id=id;var h3=document.createElement('h3');h3.id=window.id+'_header';h3.appendChild(document.createTextNode(title));window.appendChild(h3);var img_close=document.createElement('img');img_close.className='close';img_close.onclick=window_float_hide_closure(id);img_close.src='/images/window_float_close.gif';img_close.alt='Close';img_close.title='Close';window.appendChild(img_close);var div_body=document.createElement('div');div_body.className='window_float_body';div_body.id=window.id+'_content';window.appendChild(div_body);document.body.appendChild(window);}
function window_float_show_under(divid,em,offsetHeight)
{omchat_form_description_out();var div=getElement(divid);window_float_setup(div);var em_pos=get_pos(em);div.style.left=(em_pos.left)+'px';div.style.display='block';var top=(em_pos.top+em.offsetHeight+10+offsetHeight);div.style.top=top+'px';scrollToView(top,div.clientHeight);blackness_show(div);return true;}
var isIE=navigator.userAgent.toLowerCase().indexOf("msie")>-1;var isMoz=document.implementation&&document.implementation.createDocument;var isSafari=((navigator.userAgent.toLowerCase().indexOf('safari')!=-1)&&(navigator.userAgent.toLowerCase().indexOf('mac')!=-1))?true:false;function curvyCorners()
{if(typeof(arguments[0])!="object")throw newCurvyError("First parameter of curvyCorners() must be an object.");if(typeof(arguments[1])!="object"&&typeof(arguments[1])!="string")throw newCurvyError("Second parameter of curvyCorners() must be an object or a class name.");if(typeof(arguments[1])=="string")
{var startIndex=0;var boxCol=getElementsByClass(arguments[1]);}
else
{var startIndex=1;var boxCol=arguments;}
var curvyCornersCol=new Array();if(arguments[0].validTags)
var validElements=arguments[0].validTags;else
var validElements=["div"];for(var i=startIndex,j=boxCol.length;i<j;i++)
{var currentTag=boxCol[i].tagName.toLowerCase();if(inArray(validElements,currentTag)!==false)
{curvyCornersCol[curvyCornersCol.length]=new curvyObject(arguments[0],boxCol[i]);}}
this.objects=curvyCornersCol;this.applyCornersToAll=function()
{for(var x=0,k=this.objects.length;x<k;x++)
{this.objects[x].applyCorners();}}}
function curvyObject()
{this.box=arguments[1];this.settings=arguments[0];this.topContainer=null;this.bottomContainer=null;this.masterCorners=new Array();this.contentDIV=null;var boxHeight=get_style(this.box,"height","height");var boxWidth=get_style(this.box,"width","width");var borderWidth=get_style(this.box,"borderTopWidth","border-top-width");var borderColour=get_style(this.box,"borderTopColor","border-top-color");var boxColour=get_style(this.box,"backgroundColor","background-color");var backgroundImage=get_style(this.box,"backgroundImage","background-image");var boxPosition=get_style(this.box,"position","position");var boxPadding=get_style(this.box,"paddingTop","padding-top");this.boxHeight=parseInt(((boxHeight!=""&&boxHeight!="auto"&&boxHeight.indexOf("%")==-1)?boxHeight.substring(0,boxHeight.indexOf("px")):this.box.scrollHeight));this.boxWidth=parseInt(((boxWidth!=""&&boxWidth!="auto"&&boxWidth.indexOf("%")==-1)?boxWidth.substring(0,boxWidth.indexOf("px")):this.box.scrollWidth));this.borderWidth=parseInt(((borderWidth!=""&&borderWidth.indexOf("px")!==-1)?borderWidth.slice(0,borderWidth.indexOf("px")):0));this.boxColour=format_colour(boxColour);this.boxPadding=parseInt(((boxPadding!=""&&boxPadding.indexOf("px")!==-1)?boxPadding.slice(0,boxPadding.indexOf("px")):0));this.borderColour=format_colour(borderColour);this.borderString=this.borderWidth+"px"+" solid "+this.borderColour;this.backgroundImage=((backgroundImage!="none")?backgroundImage:"");this.boxContent=this.box.innerHTML;if(boxPosition!="absolute")this.box.style.position="relative";this.box.style.padding="0px";if(isIE&&boxWidth=="auto"&&boxHeight=="auto")this.box.style.width="100%";if(this.settings.autoPad==true&&this.boxPadding>0)
this.box.innerHTML="";this.applyCorners=function()
{for(var t=0;t<2;t++)
{switch(t)
{case 0:if(this.settings.tl||this.settings.tr)
{var newMainContainer=document.createElement("DIV");newMainContainer.style.width="100%";newMainContainer.style.fontSize="1px";newMainContainer.style.overflow="hidden";newMainContainer.style.position="absolute";newMainContainer.style.paddingLeft=this.borderWidth+"px";newMainContainer.style.paddingRight=this.borderWidth+"px";var topMaxRadius=Math.max(this.settings.tl?this.settings.tl.radius:0,this.settings.tr?this.settings.tr.radius:0);newMainContainer.style.height=topMaxRadius+"px";newMainContainer.style.top=0-topMaxRadius+"px";newMainContainer.style.left=0-this.borderWidth+"px";this.topContainer=this.box.appendChild(newMainContainer);}
break;case 1:if(this.settings.bl||this.settings.br)
{var newMainContainer=document.createElement("DIV");newMainContainer.style.width="100%";newMainContainer.style.fontSize="1px";newMainContainer.style.overflow="hidden";newMainContainer.style.position="absolute";newMainContainer.style.paddingLeft=this.borderWidth+"px";newMainContainer.style.paddingRight=this.borderWidth+"px";var botMaxRadius=Math.max(this.settings.bl?this.settings.bl.radius:0,this.settings.br?this.settings.br.radius:0);newMainContainer.style.height=botMaxRadius+"px";newMainContainer.style.bottom=0-botMaxRadius+"px";newMainContainer.style.left=0-this.borderWidth+"px";this.bottomContainer=this.box.appendChild(newMainContainer);}
break;}}
if(this.topContainer)this.box.style.borderTopWidth="0px";if(this.bottomContainer)this.box.style.borderBottomWidth="0px";var corners=["tr","tl","br","bl"];for(var i in corners)
{if(i>-1<4)
{var cc=corners[i];if(!this.settings[cc])
{if(((cc=="tr"||cc=="tl")&&this.topContainer!=null)||((cc=="br"||cc=="bl")&&this.bottomContainer!=null))
{var newCorner=document.createElement("DIV");newCorner.style.position="relative";newCorner.style.fontSize="1px";newCorner.style.overflow="hidden";if(this.backgroundImage=="")
newCorner.style.backgroundColor=this.boxColour;else
newCorner.style.backgroundImage=this.backgroundImage;switch(cc)
{case"tl":newCorner.style.height=topMaxRadius-this.borderWidth+"px";newCorner.style.marginRight=this.settings.tr.radius-(this.borderWidth*2)+"px";newCorner.style.borderLeft=this.borderString;newCorner.style.borderTop=this.borderString;newCorner.style.left=-this.borderWidth+"px";break;case"tr":newCorner.style.height=topMaxRadius-this.borderWidth+"px";newCorner.style.marginLeft=this.settings.tl.radius-(this.borderWidth*2)+"px";newCorner.style.borderRight=this.borderString;newCorner.style.borderTop=this.borderString;newCorner.style.backgroundPosition="-"+(topMaxRadius+this.borderWidth)+"px 0px";newCorner.style.left=this.borderWidth+"px";break;case"bl":newCorner.style.height=botMaxRadius-this.borderWidth+"px";newCorner.style.marginRight=this.settings.br.radius-(this.borderWidth*2)+"px";newCorner.style.borderLeft=this.borderString;newCorner.style.borderBottom=this.borderString;newCorner.style.left=-this.borderWidth+"px";newCorner.style.backgroundPosition="-"+(this.borderWidth)+"px -"+(this.boxHeight+(botMaxRadius+this.borderWidth))+"px";break;case"br":newCorner.style.height=botMaxRadius-this.borderWidth+"px";newCorner.style.marginLeft=this.settings.bl.radius-(this.borderWidth*2)+"px";newCorner.style.borderRight=this.borderString;newCorner.style.borderBottom=this.borderString;newCorner.style.left=this.borderWidth+"px"
newCorner.style.backgroundPosition="-"+(botMaxRadius+this.borderWidth)+"px -"+(this.boxHeight+(botMaxRadius+this.borderWidth))+"px";break;}}}
else
{if(this.masterCorners[this.settings[cc].radius])
{var newCorner=this.masterCorners[this.settings[cc].radius].cloneNode(true);}
else
{var newCorner=document.createElement("DIV");newCorner.style.height=this.settings[cc].radius+"px";newCorner.style.width=this.settings[cc].radius+"px";newCorner.style.position="absolute";newCorner.style.fontSize="1px";newCorner.style.overflow="hidden";var borderRadius=parseInt(this.settings[cc].radius-this.borderWidth);for(var intx=0,j=this.settings[cc].radius;intx<j;intx++)
{if((intx+1)>=borderRadius)
var y1=-1;else
var y1=(Math.floor(Math.sqrt(Math.pow(borderRadius,2)-Math.pow((intx+1),2)))-1);if(borderRadius!=j)
{if((intx)>=borderRadius)
var y2=-1;else
var y2=Math.ceil(Math.sqrt(Math.pow(borderRadius,2)-Math.pow(intx,2)));if((intx+1)>=j)
var y3=-1;else
var y3=(Math.floor(Math.sqrt(Math.pow(j,2)-Math.pow((intx+1),2)))-1);}
if((intx)>=j)
var y4=-1;else
var y4=Math.ceil(Math.sqrt(Math.pow(j,2)-Math.pow(intx,2)));if(y1>-1)this.drawPixel(intx,0,this.boxColour,100,(y1+1),newCorner,-1,this.settings[cc].radius);if(borderRadius!=j)
{for(var inty=(y1+1);inty<y2;inty++)
{if(this.settings.antiAlias)
{if(this.backgroundImage!="")
{var borderFract=(pixelFraction(intx,inty,borderRadius)*100);if(borderFract<30)
{this.drawPixel(intx,inty,this.borderColour,100,1,newCorner,0,this.settings[cc].radius);}
else
{this.drawPixel(intx,inty,this.borderColour,100,1,newCorner,-1,this.settings[cc].radius);}}
else
{var pixelcolour=BlendColour(this.boxColour,this.borderColour,pixelFraction(intx,inty,borderRadius));this.drawPixel(intx,inty,pixelcolour,100,1,newCorner,0,this.settings[cc].radius,cc);}}}
if(this.settings.antiAlias)
{if(y3>=y2)
{if(y2==-1)y2=0;this.drawPixel(intx,y2,this.borderColour,100,(y3-y2+1),newCorner,0,0);}}
else
{if(y3>=y1)
{this.drawPixel(intx,(y1+1),this.borderColour,100,(y3-y1),newCorner,0,0);}}
var outsideColour=this.borderColour;}
else
{var outsideColour=this.boxColour;var y3=y1;}
if(this.settings.antiAlias)
{for(var inty=(y3+1);inty<y4;inty++)
{this.drawPixel(intx,inty,outsideColour,(pixelFraction(intx,inty,j)*100),1,newCorner,((this.borderWidth>0)?0:-1),this.settings[cc].radius);}}}
this.masterCorners[this.settings[cc].radius]=newCorner.cloneNode(true);}
if(cc!="br")
{for(var t=0,k=newCorner.childNodes.length;t<k;t++)
{var pixelBar=newCorner.childNodes[t];var pixelBarTop=parseInt(pixelBar.style.top.substring(0,pixelBar.style.top.indexOf("px")));var pixelBarLeft=parseInt(pixelBar.style.left.substring(0,pixelBar.style.left.indexOf("px")));var pixelBarHeight=parseInt(pixelBar.style.height.substring(0,pixelBar.style.height.indexOf("px")));if(cc=="tl"||cc=="bl"){pixelBar.style.left=this.settings[cc].radius-pixelBarLeft-1+"px";}
if(cc=="tr"||cc=="tl"){pixelBar.style.top=this.settings[cc].radius-pixelBarHeight-pixelBarTop+"px";}
switch(cc)
{case"tr":pixelBar.style.backgroundPosition="-"+Math.abs((this.boxWidth-this.settings[cc].radius+this.borderWidth)+pixelBarLeft)+"px -"+Math.abs(this.settings[cc].radius-pixelBarHeight-pixelBarTop-this.borderWidth)+"px";break;case"tl":pixelBar.style.backgroundPosition="-"+Math.abs((this.settings[cc].radius-pixelBarLeft-1)-this.borderWidth)+"px -"+Math.abs(this.settings[cc].radius-pixelBarHeight-pixelBarTop-this.borderWidth)+"px";break;case"bl":pixelBar.style.backgroundPosition="-"+Math.abs((this.settings[cc].radius-pixelBarLeft-1)-this.borderWidth)+"px -"+Math.abs((this.boxHeight+this.settings[cc].radius+pixelBarTop)-this.borderWidth)+"px";break;}}}}
if(newCorner)
{switch(cc)
{case"tl":if(newCorner.style.position=="absolute")newCorner.style.top="0px";if(newCorner.style.position=="absolute")newCorner.style.left="0px";if(this.topContainer)this.topContainer.appendChild(newCorner);break;case"tr":if(newCorner.style.position=="absolute")newCorner.style.top="0px";if(newCorner.style.position=="absolute")newCorner.style.right="0px";if(this.topContainer)this.topContainer.appendChild(newCorner);break;case"bl":if(newCorner.style.position=="absolute")newCorner.style.bottom="0px";if(newCorner.style.position=="absolute")newCorner.style.left="0px";if(this.bottomContainer)this.bottomContainer.appendChild(newCorner);break;case"br":if(newCorner.style.position=="absolute")newCorner.style.bottom="0px";if(newCorner.style.position=="absolute")newCorner.style.right="0px";if(this.bottomContainer)this.bottomContainer.appendChild(newCorner);break;}}}}
var radiusDiff=new Array();radiusDiff["t"]=Math.abs(this.settings.tl.radius-this.settings.tr.radius)
radiusDiff["b"]=Math.abs(this.settings.bl.radius-this.settings.br.radius);for(z in radiusDiff)
{if(z=="t"||z=="b")
{if(radiusDiff[z])
{var smallerCornerType=((this.settings[z+"l"].radius<this.settings[z+"r"].radius)?z+"l":z+"r");var newFiller=document.createElement("DIV");newFiller.style.height=radiusDiff[z]+"px";newFiller.style.width=this.settings[smallerCornerType].radius+"px"
newFiller.style.position="absolute";newFiller.style.fontSize="1px";newFiller.style.overflow="hidden";newFiller.style.backgroundColor=this.boxColour;switch(smallerCornerType)
{case"tl":newFiller.style.bottom="0px";newFiller.style.left="0px";newFiller.style.borderLeft=this.borderString;this.topContainer.appendChild(newFiller);break;case"tr":newFiller.style.bottom="0px";newFiller.style.right="0px";newFiller.style.borderRight=this.borderString;this.topContainer.appendChild(newFiller);break;case"bl":newFiller.style.top="0px";newFiller.style.left="0px";newFiller.style.borderLeft=this.borderString;this.bottomContainer.appendChild(newFiller);break;case"br":newFiller.style.top="0px";newFiller.style.right="0px";newFiller.style.borderRight=this.borderString;this.bottomContainer.appendChild(newFiller);break;}}
var newFillerBar=document.createElement("DIV");newFillerBar.style.position="relative";newFillerBar.style.fontSize="1px";newFillerBar.style.overflow="hidden";newFillerBar.style.backgroundColor=this.boxColour;newFillerBar.style.backgroundImage=this.backgroundImage;switch(z)
{case"t":if(this.topContainer)
{if(this.settings.tl.radius&&this.settings.tr.radius)
{newFillerBar.style.height=topMaxRadius-this.borderWidth+"px";newFillerBar.style.marginLeft=this.settings.tl.radius-this.borderWidth+"px";newFillerBar.style.marginRight=this.settings.tr.radius-this.borderWidth+"px";newFillerBar.style.borderTop=this.borderString;if(this.backgroundImage!="")
newFillerBar.style.backgroundPosition="-"+(topMaxRadius+this.borderWidth)+"px 0px";this.topContainer.appendChild(newFillerBar);}
this.box.style.backgroundPosition="0px -"+(topMaxRadius-this.borderWidth)+"px";}
break;case"b":if(this.bottomContainer)
{if(this.settings.bl.radius&&this.settings.br.radius)
{newFillerBar.style.height=botMaxRadius-this.borderWidth+"px";newFillerBar.style.marginLeft=this.settings.bl.radius-this.borderWidth+"px";newFillerBar.style.marginRight=this.settings.br.radius-this.borderWidth+"px";newFillerBar.style.borderBottom=this.borderString;if(this.backgroundImage!="")
newFillerBar.style.backgroundPosition="-"+(botMaxRadius+this.borderWidth)+"px -"+(this.boxHeight+(topMaxRadius+this.borderWidth))+"px";this.bottomContainer.appendChild(newFillerBar);}}
break;}}}
if(this.settings.autoPad==true&&this.boxPadding>0)
{var contentContainer=document.createElement("DIV");contentContainer.style.position="relative";contentContainer.innerHTML=this.boxContent;contentContainer.className="autoPadDiv";var topPadding=Math.abs(topMaxRadius-this.boxPadding);var botPadding=Math.abs(botMaxRadius-this.boxPadding);if(topMaxRadius<this.boxPadding)
contentContainer.style.paddingTop=topPadding+"px";if(botMaxRadius<this.boxPadding)
contentContainer.style.paddingBottom=botMaxRadius+"px";contentContainer.style.paddingLeft=this.boxPadding+"px";contentContainer.style.paddingRight=this.boxPadding+"px";this.contentDIV=this.box.appendChild(contentContainer);}}
this.drawPixel=function(intx,inty,colour,transAmount,height,newCorner,image,cornerRadius)
{var pixel=document.createElement("DIV");pixel.style.height=height+"px";pixel.style.width="1px";pixel.style.position="absolute";pixel.style.fontSize="1px";pixel.style.overflow="hidden";var topMaxRadius=Math.max(this.settings["tr"].radius,this.settings["tl"].radius);if(image==-1&&this.backgroundImage!="")
{pixel.style.backgroundImage=this.backgroundImage;pixel.style.backgroundPosition="-"+(this.boxWidth-(cornerRadius-intx)+this.borderWidth)+"px -"+((this.boxHeight+topMaxRadius+inty)-this.borderWidth)+"px";}
else
{pixel.style.backgroundColor=colour;}
if(transAmount!=100)
setOpacity(pixel,transAmount);pixel.style.top=inty+"px";pixel.style.left=intx+"px";newCorner.appendChild(pixel);}}
function insertAfter(parent,node,referenceNode)
{parent.insertBefore(node,referenceNode.nextSibling);}
function BlendColour(Col1,Col2,Col1Fraction)
{var red1=parseInt(Col1.substr(1,2),16);var green1=parseInt(Col1.substr(3,2),16);var blue1=parseInt(Col1.substr(5,2),16);var red2=parseInt(Col2.substr(1,2),16);var green2=parseInt(Col2.substr(3,2),16);var blue2=parseInt(Col2.substr(5,2),16);if(Col1Fraction>1||Col1Fraction<0)Col1Fraction=1;var endRed=Math.round((red1*Col1Fraction)+(red2*(1-Col1Fraction)));if(endRed>255)endRed=255;if(endRed<0)endRed=0;var endGreen=Math.round((green1*Col1Fraction)+(green2*(1-Col1Fraction)));if(endGreen>255)endGreen=255;if(endGreen<0)endGreen=0;var endBlue=Math.round((blue1*Col1Fraction)+(blue2*(1-Col1Fraction)));if(endBlue>255)endBlue=255;if(endBlue<0)endBlue=0;return"#"+IntToHex(endRed)+IntToHex(endGreen)+IntToHex(endBlue);}
function IntToHex(strNum)
{base=strNum/16;rem=strNum%16;base=base-(rem/16);baseS=MakeHex(base);remS=MakeHex(rem);return baseS+''+remS;}
function MakeHex(x)
{if((x>=0)&&(x<=9))
{return x;}
else
{switch(x)
{case 10:return"A";case 11:return"B";case 12:return"C";case 13:return"D";case 14:return"E";case 15:return"F";}}}
function pixelFraction(x,y,r)
{var pixelfraction=0;var xvalues=new Array(1);var yvalues=new Array(1);var point=0;var whatsides="";var intersect=Math.sqrt((Math.pow(r,2)-Math.pow(x,2)));if((intersect>=y)&&(intersect<(y+1)))
{whatsides="Left";xvalues[point]=0;yvalues[point]=intersect-y;point=point+1;}
var intersect=Math.sqrt((Math.pow(r,2)-Math.pow(y+1,2)));if((intersect>=x)&&(intersect<(x+1)))
{whatsides=whatsides+"Top";xvalues[point]=intersect-x;yvalues[point]=1;point=point+1;}
var intersect=Math.sqrt((Math.pow(r,2)-Math.pow(x+1,2)));if((intersect>=y)&&(intersect<(y+1)))
{whatsides=whatsides+"Right";xvalues[point]=1;yvalues[point]=intersect-y;point=point+1;}
var intersect=Math.sqrt((Math.pow(r,2)-Math.pow(y,2)));if((intersect>=x)&&(intersect<(x+1)))
{whatsides=whatsides+"Bottom";xvalues[point]=intersect-x;yvalues[point]=0;}
switch(whatsides)
{case"LeftRight":pixelfraction=Math.min(yvalues[0],yvalues[1])+((Math.max(yvalues[0],yvalues[1])-Math.min(yvalues[0],yvalues[1]))/2);break;case"TopRight":pixelfraction=1-(((1-xvalues[0])*(1-yvalues[1]))/2);break;case"TopBottom":pixelfraction=Math.min(xvalues[0],xvalues[1])+((Math.max(xvalues[0],xvalues[1])-Math.min(xvalues[0],xvalues[1]))/2);break;case"LeftBottom":pixelfraction=(yvalues[0]*xvalues[1])/2;break;default:pixelfraction=1;}
return pixelfraction;}
function rgb2Hex(rgbColour)
{try{var rgbArray=rgb2Array(rgbColour);var red=parseInt(rgbArray[0]);var green=parseInt(rgbArray[1]);var blue=parseInt(rgbArray[2]);var hexColour="#"+IntToHex(red)+IntToHex(green)+IntToHex(blue);}
catch(e){alert("There was an error converting the RGB value to Hexadecimal in function rgb2Hex");}
return hexColour;}
function rgb2Array(rgbColour)
{var rgbValues=rgbColour.substring(4,rgbColour.indexOf(")"));var rgbArray=rgbValues.split(", ");return rgbArray;}
function setOpacity(obj,opacity)
{opacity=(opacity==100)?99.999:opacity;if(isSafari&&obj.tagName!="IFRAME")
{var rgbArray=rgb2Array(obj.style.backgroundColor);var red=parseInt(rgbArray[0]);var green=parseInt(rgbArray[1]);var blue=parseInt(rgbArray[2]);obj.style.backgroundColor="rgba("+red+", "+green+", "+blue+", "+opacity/100+")";}
else if(typeof(obj.style.opacity)!="undefined")
{obj.style.opacity=opacity/100;}
else if(typeof(obj.style.MozOpacity)!="undefined")
{obj.style.MozOpacity=opacity/100;}
else if(typeof(obj.style.filter)!="undefined")
{obj.style.filter="alpha(opacity:"+opacity+")";}
else if(typeof(obj.style.KHTMLOpacity)!="undefined")
{obj.style.KHTMLOpacity=opacity/100;}}
function inArray(array,value)
{for(var i=0;i<array.length;i++){if(array[i]===value)return i;}
return false;}
function inArrayKey(array,value)
{for(key in array){if(key===value)return true;}
return false;}
function addEvent(elm,evType,fn,useCapture){if(elm.addEventListener){elm.addEventListener(evType,fn,useCapture);return true;}
else if(elm.attachEvent){var r=elm.attachEvent('on'+evType,fn);return r;}
else{elm['on'+evType]=fn;}}
function removeEvent(obj,evType,fn,useCapture){if(obj.removeEventListener){obj.removeEventListener(evType,fn,useCapture);return true;}else if(obj.detachEvent){var r=obj.detachEvent("on"+evType,fn);return r;}else{alert("Handler could not be removed");}}
function format_colour(colour)
{var returnColour="#ffffff";if(colour!=""&&colour!="transparent")
{if(colour.substr(0,3)=="rgb")
{returnColour=rgb2Hex(colour);}
else if(colour.length==4)
{returnColour="#"+colour.substring(1,2)+colour.substring(1,2)+colour.substring(2,3)+colour.substring(2,3)+colour.substring(3,4)+colour.substring(3,4);}
else
{returnColour=colour;}}
return returnColour;}
function get_style(obj,property,propertyNS)
{try
{if(obj.currentStyle)
{var returnVal=eval("obj.currentStyle."+property);}
else
{if(isSafari&&obj.style.display=="none")
{obj.style.display="";var wasHidden=true;}
var returnVal=document.defaultView.getComputedStyle(obj,'').getPropertyValue(propertyNS);if(isSafari&&wasHidden)
{obj.style.display="none";}}}
catch(e)
{}
return returnVal;}
function getElementsByClass(searchClass,node,tag)
{var classElements=new Array();if(node==null)
node=document;if(tag==null)
tag='*';var els=node.getElementsByTagName(tag);var elsLen=els.length;var pattern=new RegExp("(^|\s)"+searchClass+"(\s|$)");for(i=0,j=0;i<elsLen;i++)
{if(pattern.test(els[i].className))
{classElements[j]=els[i];j++;}}
return classElements;}
function newCurvyError(errorMessage)
{return new Error("curvyCorners Error:\n"+errorMessage)}