var ddtabmenu={disabletablinks:false,snap2original:[true,1000],currentpageurl:window.location.href.replace("http://"+window.location.hostname,"").replace(/^\//,""),definemenu:function(a,b){this[a+"-menuitems"]=null;this[a+"-dselected"]=-1;if(undefined!=document.getElementById(a)){ddtabmenu.init(a,b)}this.addEvent(window,function(){ddtabmenu.init(a,b)},"load")},showsubmenu:function(b,a){var c=this[b+"-menuitems"];this.clearrevert2default(b);for(i=0;i<c.length;i++){c[i].className="";if(typeof c[i].hasSubContent!="undefined"){document.getElementById(c[i].getAttribute("rel")).style.display="none"}}a.className="current";if(typeof a.hasSubContent!="undefined"){document.getElementById(a.getAttribute("rel")).style.display="block"}},isSelected:function(a){var a=a.replace("http://"+a.hostname,"").replace(/^\//,"");return(ddtabmenu.currentpageurl==a)},isContained:function(a,b){var b=window.event||b;var d=b.relatedTarget||((b.type=="mouseover")?b.fromElement:b.toElement);while(d&&d!=a){try{d=d.parentNode}catch(b){d=a}}if(d==a){return true}else{return false}},revert2default:function(a,b,c){if(!ddtabmenu.isContained(a,b,c)){window["hidetimer_"+b]=setTimeout(function(){ddtabmenu.showsubmenu(b,ddtabmenu[b+"-dselected"])},ddtabmenu.snap2original[1])}},clearrevert2default:function(a){if(typeof window["hidetimer_"+a]!="undefined"){clearTimeout(window["hidetimer_"+a])}},addEvent:function(b,c,a){var a=(window.addEventListener)?a:"on"+a;if(b.addEventListener){b.addEventListener(a,c,false)}else{if(b.attachEvent){b.attachEvent(a,c)}}},init:function(c,d){var f=document.getElementById(c).getElementsByTagName("a");this[c+"-menuitems"]=f;for(var a=0;a<f.length;a++){if(f[a].getAttribute("rel")){this[c+"-menuitems"][a].hasSubContent=true;if(ddtabmenu.disabletablinks){f[a].onclick=function(){return false}}if(ddtabmenu.snap2original[0]==true){var e=document.getElementById(f[a].getAttribute("rel"));f[a].onmouseout=function(g){ddtabmenu.revert2default(e,c,g)};e.onmouseover=function(){ddtabmenu.clearrevert2default(c)};e.onmouseout=function(g){ddtabmenu.revert2default(this,c,g)}}}else{f[a].onmouseout=function(g){this.className="";if(ddtabmenu.snap2original[0]==true){ddtabmenu.revert2default(this,c,g)}}}f[a].onmouseover=function(){ddtabmenu.showsubmenu(c,this)};if(d=="auto"&&typeof b=="undefined"&&this.isSelected(f[a].href)){ddtabmenu.showsubmenu(c,f[a]);this[c+"-dselected"]=f[a];var b=true}else{if(parseInt(d)==a){ddtabmenu.showsubmenu(c,f[a]);this[c+"-dselected"]=f[a]}}}}};function ddtabcontent(a){this.tabinterfaceid=a;this.tabs=document.getElementById(a).getElementsByTagName("a");this.enabletabpersistence=true;this.hottabspositions=[];this.currentTabIndex=0;this.subcontentids=[];this.revcontentids=[];this.selectedClassTarget="link"}ddtabcontent.getCookie=function(a){var b=new RegExp(a+"=[^;]+","i");if(document.cookie.match(b)){return document.cookie.match(b)[0].split("=")[1]}return""};ddtabcontent.setCookie=function(a,b){document.cookie=a+"="+b+";path=/"};ddtabcontent.prototype={expandit:function(a){this.cancelautorun();var b="";try{if(typeof a=="string"&&document.getElementById(a).getAttribute("rel")){b=document.getElementById(a)}else{if(parseInt(a)!=NaN&&this.tabs[a].getAttribute("rel")){b=this.tabs[a]}}}catch(c){alert("Invalid Tab ID or position entered!")}if(b!=""){this.expandtab(b)}},cycleit:function(b,a){if(b=="next"){var c=(this.currentTabIndex<this.hottabspositions.length-1)?this.currentTabIndex+1:0}else{if(b=="prev"){var c=(this.currentTabIndex>0)?this.currentTabIndex-1:this.hottabspositions.length-1}}if(typeof a=="undefined"){this.cancelautorun()}this.expandtab(this.tabs[this.hottabspositions[c]])},setpersist:function(a){this.enabletabpersistence=a},setselectedClassTarget:function(a){this.selectedClassTarget=a||"link"},getselectedClassTarget:function(a){return(this.selectedClassTarget==("linkparent".toLowerCase()))?a.parentNode:a},expandtab:function(b){var c=b.getAttribute("rel");var d=(b.getAttribute("rev"))?","+b.getAttribute("rev").replace(/\s+/,"")+",":"";this.expandsubcontent(c);this.expandrevcontent(d);for(var a=0;a<this.tabs.length;a++){this.getselectedClassTarget(this.tabs[a]).className=(this.tabs[a].getAttribute("rel")==c)?"selected":""}if(this.enabletabpersistence){ddtabcontent.setCookie(this.tabinterfaceid,b.tabposition)}this.setcurrenttabindex(b.tabposition)},expandsubcontent:function(c){for(var b=0;b<this.subcontentids.length;b++){var a=document.getElementById(this.subcontentids[b]);a.style.display=(a.id==c)?"block":"none"}},expandrevcontent:function(c){var a=this.revcontentids;for(var b=0;b<a.length;b++){document.getElementById(a[b]).style.display=(c.indexOf(","+a[b]+",")!=-1)?"block":"none"}},setcurrenttabindex:function(a){for(var b=0;b<this.hottabspositions.length;b++){if(a==this.hottabspositions[b]){this.currentTabIndex=b;break}}},autorun:function(){this.cycleit("next",true)},cancelautorun:function(){if(typeof this.autoruntimer!="undefined"){clearInterval(this.autoruntimer)}},init:function(a){var e=ddtabcontent.getCookie(this.tabinterfaceid);var d=true;this.automodeperiod=a||0;for(var c=0;c<this.tabs.length;c++){this.tabs[c].tabposition=c;if(this.tabs[c].getAttribute("rel")){var b=this;this.hottabspositions[this.hottabspositions.length]=c;this.subcontentids[this.subcontentids.length]=this.tabs[c].getAttribute("rel");this.tabs[c].onclick=function(){b.expandtab(this);b.cancelautorun();return false};if(this.tabs[c].getAttribute("rev")){this.revcontentids=this.revcontentids.concat(this.tabs[c].getAttribute("rev").split(/\s*,\s*/))}if(this.enabletabpersistence&&parseInt(e)==c||!this.enabletabpersistence&&this.getselectedClassTarget(this.tabs[c]).className=="selected"){this.expandtab(this.tabs[c]);d=false}}}if(d){this.expandtab(this.tabs[this.hottabspositions[0]])}if(parseInt(this.automodeperiod)>500&&this.hottabspositions.length>1){this.autoruntimer=setInterval(function(){b.autorun()},this.automodeperiod)}}};var dropdowncontent={delaybeforehide:200,disableanchorlink:true,ajaxloadingmsg:"Loading content. Please wait...",ajaxbustcache:true,getposOffset:function(b,a){return(b.offsetParent)?b[a]+this.getposOffset(b.offsetParent,a):b[a]},isContained:function(a,b){var b=window.event||b;var d=b.relatedTarget||((b.type=="mouseover")?b.fromElement:b.toElement);while(d&&d!=a){try{d=d.parentNode}catch(b){d=a}}if(d==a){return true}else{return false}},show:function(b,d,f){if(!this.isContained(b,f)){var c=(d.dropposition[0]=="left")?-(d.offsetWidth-b.offsetWidth):0;var a=(d.dropposition[1]=="top")?-d.offsetHeight:b.offsetHeight;d.style.left=this.getposOffset(b,"offsetLeft")+c+"px";d.style.top=this.getposOffset(b,"offsetTop")+a+"px";d.style.clip=(d.dropposition[1]=="top")?"rect(auto auto auto 0)":"rect(0 auto 0 0)";d.style.visibility="visible";d.startTime=new Date().getTime();d.contentheight=parseInt(d.offsetHeight);if(typeof window["hidetimer_"+d.id]!="undefined"){clearTimeout(window["hidetimer_"+d.id])}this.slideengine(d,(d.dropposition[1]=="top")?"up":"down")}},curveincrement:function(a){return(1-Math.cos(a*Math.PI))/2},slideengine:function(e,d){var b=new Date().getTime()-e.startTime;if(b<e.glidetime){var a=(d=="down")?this.curveincrement(b/e.glidetime):1-this.curveincrement(b/e.glidetime);var c=(a*e.contentheight)+"px";e.style.clip=(d=="down")?"rect(0 auto "+c+" 0)":"rect("+c+" auto auto 0)";window["glidetimer_"+e.id]=setTimeout(function(){dropdowncontent.slideengine(e,d)},10)}else{e.style.clip="rect(0 auto auto 0)"}},hide:function(b,a,c){if(!dropdowncontent.isContained(b,c)){window["hidetimer_"+a.id]=setTimeout(function(){a.style.visibility="hidden";a.style.left=a.style.top=0;clearTimeout(window["glidetimer_"+a.id])},dropdowncontent.delaybeforehide)}},ajaxconnect:function(a,b){var f=false;var d="";if(window.XMLHttpRequest){f=new XMLHttpRequest()}else{if(window.ActiveXObject){try{f=new ActiveXObject("Msxml2.XMLHTTP")}catch(c){try{f=new ActiveXObject("Microsoft.XMLHTTP")}catch(c){}}}else{return false}}document.getElementById(b).innerHTML=this.ajaxloadingmsg;f.onreadystatechange=function(){dropdowncontent.loadpage(f,b)};if(this.ajaxbustcache){d=(a.indexOf("?")!=-1)?"&"+new Date().getTime():"?"+new Date().getTime()}f.open("GET",a+d,true);f.send(null)},loadpage:function(b,a){if(b.readyState==4&&(b.status==200||window.location.href.indexOf("http")==-1)){document.getElementById(a).innerHTML=b.responseText}},init:function(a,f,e){var c=document.getElementById(a);var d=document.getElementById(c.getAttribute("rel"));var b=c.getAttribute("rev");if(b!=null&&b!=""){this.ajaxconnect(b,c.getAttribute("rel"))}d.dropposition=f.split("-");d.glidetime=e||1000;d.style.left=d.style.top=0;c.onmouseover=function(g){dropdowncontent.show(this,d,g)};c.onmouseout=function(g){dropdowncontent.hide(d,d,g)};if(this.disableanchorlink){c.onclick=function(){return false}}d.onmouseout=function(g){dropdowncontent.hide(this,d,g)}}};/* Nifty Corners Cube - rounded corners with CSS and Javascript
Copyright 2006 Alessandro Fulciniti (a.fulciniti@html.it)

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

var niftyOk=(document.getElementById && document.createElement && Array.prototype.push);
var niftyCss=false;

String.prototype.find=function(what){
return(this.indexOf(what)>=0 ? true : false);
}

var oldonload=window.onload;
if(typeof(NiftyLoad)!='function') NiftyLoad=function(){};
if(typeof(oldonload)=='function')
    window.onload=function(){oldonload();AddCss();NiftyLoad()};
else window.onload=function(){AddCss();NiftyLoad()};

function AddCss(){
niftyCss=true;
var l=CreateEl("link");
l.setAttribute("type","text/css");
l.setAttribute("rel","stylesheet");
l.setAttribute("href","http://static.netxl.in/css/niftyCorners.css");
l.setAttribute("media","screen");
document.getElementsByTagName("head")[0].appendChild(l);
}

function Nifty(selector,options){
if(niftyOk==false) return;
if(niftyCss==false) AddCss();
var i,v=selector.split(","),h=0;
if(options==null) options="";
if(options.find("fixed-height"))
    h=getElementsBySelector(v[0])[0].offsetHeight;
for(i=0;i<v.length;i++)
    Rounded(v[i],options);
if(options.find("height")) SameHeight(selector,h);
}

function Rounded(selector,options){
var i,top="",bottom="",v=new Array();
if(options!=""){
    options=options.replace("left","tl bl");
    options=options.replace("right","tr br");
    options=options.replace("top","tr tl");
    options=options.replace("bottom","br bl");
    options=options.replace("transparent","alias");
    if(options.find("tl")){
        top="both";
        if(!options.find("tr")) top="left";
        }
    else if(options.find("tr")) top="right";
    if(options.find("bl")){
        bottom="both";
        if(!options.find("br")) bottom="left";
        }
    else if(options.find("br")) bottom="right";
    }
if(top=="" && bottom=="" && !options.find("none")){top="both";bottom="both";}
v=getElementsBySelector(selector);
for(i=0;i<v.length;i++){
    FixIE(v[i]);
    if(top!="") AddTop(v[i],top,options);
    if(bottom!="") AddBottom(v[i],bottom,options);
    }
}

function AddTop(el,side,options){
var d=CreateEl("b"),lim=4,border="",p,i,btype="r",bk,color;
d.style.marginLeft="-"+getPadding(el,"Left")+"px";
d.style.marginRight="-"+getPadding(el,"Right")+"px";
if(options.find("alias") || (color=getBk(el))=="transparent"){
    color="transparent";bk="transparent"; border=getParentBk(el);btype="t";
    }
else{
    bk=getParentBk(el); border=Mix(color,bk);
    }
d.style.background=bk;
d.className="niftycorners";
p=getPadding(el,"Top");
if(options.find("small")){
    d.style.marginBottom=(p-2)+"px";
    btype+="s"; lim=2;
    }
else if(options.find("big")){
    d.style.marginBottom=(p-10)+"px";
    btype+="b"; lim=8;
    }
else d.style.marginBottom=(p-5)+"px";
for(i=1;i<=lim;i++)
    d.appendChild(CreateStrip(i,side,color,border,btype));
el.style.paddingTop="0";
el.insertBefore(d,el.firstChild);
}

function AddBottom(el,side,options){
var d=CreateEl("b"),lim=4,border="",p,i,btype="r",bk,color;
d.style.marginLeft="-"+getPadding(el,"Left")+"px";
d.style.marginRight="-"+getPadding(el,"Right")+"px";
if(options.find("alias") || (color=getBk(el))=="transparent"){
    color="transparent";bk="transparent"; border=getParentBk(el);btype="t";
    }
else{
    bk=getParentBk(el); border=Mix(color,bk);
    }
d.style.background=bk;
d.className="niftycorners";
p=getPadding(el,"Bottom");
if(options.find("small")){
    d.style.marginTop=(p-2)+"px";
    btype+="s"; lim=2;
    }
else if(options.find("big")){
    d.style.marginTop=(p-10)+"px";
    btype+="b"; lim=8;
    }
else d.style.marginTop=(p-5)+"px";
for(i=lim;i>0;i--)
    d.appendChild(CreateStrip(i,side,color,border,btype));
el.style.paddingBottom=0;
el.appendChild(d);
}

function CreateStrip(index,side,color,border,btype){
var x=CreateEl("b");
x.className=btype+index;
x.style.backgroundColor=color;
x.style.borderColor=border;
if(side=="left"){
    x.style.borderRightWidth="0";
    x.style.marginRight="0";
    }
else if(side=="right"){
    x.style.borderLeftWidth="0";
    x.style.marginLeft="0";
    }
return(x);
}

function CreateEl(x){
return(document.createElement(x));
}

function FixIE(el){
if(el.currentStyle!=null && el.currentStyle.hasLayout!=null && el.currentStyle.hasLayout==false)
    el.style.display="inline-block";
}

function SameHeight(selector,maxh){
var i,v=selector.split(","),t,j,els=[],gap;
for(i=0;i<v.length;i++){
    t=getElementsBySelector(v[i]);
    els=els.concat(t);
    }
for(i=0;i<els.length;i++){
    if(els[i].offsetHeight>maxh) maxh=els[i].offsetHeight;
    els[i].style.height="auto";
    }
for(i=0;i<els.length;i++){
    gap=maxh-els[i].offsetHeight;
    if(gap>0){
        t=CreateEl("b");t.className="niftyfill";t.style.height=gap+"px";
        nc=els[i].lastChild;
        if(nc.className=="niftycorners")
            els[i].insertBefore(t,nc);
        else els[i].appendChild(t);
        }
    }
}

function getElementsBySelector(selector){
var i,j,selid="",selclass="",tag=selector,tag2="",v2,k,f,a,s=[],objlist=[],c;
if(selector.find("#")){ //id selector like "tag#id"
    if(selector.find(" ")){  //descendant selector like "tag#id tag"
        s=selector.split(" ");
        var fs=s[0].split("#");
        if(fs.length==1) return(objlist);
        f=document.getElementById(fs[1]);
        if(f){
            v=f.getElementsByTagName(s[1]);
            for(i=0;i<v.length;i++) objlist.push(v[i]);
            }
        return(objlist);
        }
    else{
        s=selector.split("#");
        tag=s[0];
        selid=s[1];
        if(selid!=""){
            f=document.getElementById(selid);
            if(f) objlist.push(f);
            return(objlist);
            }
        }
    }
if(selector.find(".")){      //class selector like "tag.class"
    s=selector.split(".");
    tag=s[0];
    selclass=s[1];
    if(selclass.find(" ")){   //descendant selector like tag1.classname tag2
        s=selclass.split(" ");
        selclass=s[0];
        tag2=s[1];
        }
    }
var v=document.getElementsByTagName(tag);  // tag selector like "tag"
if(selclass==""){
    for(i=0;i<v.length;i++) objlist.push(v[i]);
    return(objlist);
    }
for(i=0;i<v.length;i++){
    c=v[i].className.split(" ");
    for(j=0;j<c.length;j++){
        if(c[j]==selclass){
            if(tag2=="") objlist.push(v[i]);
            else{
                v2=v[i].getElementsByTagName(tag2);
                for(k=0;k<v2.length;k++) objlist.push(v2[k]);
                }
            }
        }
    }
return(objlist);
}

function getParentBk(x){
var el=x.parentNode,c;
while(el.tagName.toUpperCase()!="HTML" && (c=getBk(el))=="transparent")
    el=el.parentNode;
if(c=="transparent") c="#FFFFFF";
return(c);
}

function getBk(x){
var c=getStyleProp(x,"backgroundColor");
if(c==null || c=="transparent" || c.find("rgba(0, 0, 0, 0)"))
    return("transparent");
if(c.find("rgb")) c=rgb2hex(c);
return(c);
}

function getPadding(x,side){
var p=getStyleProp(x,"padding"+side);
if(p==null || !p.find("px")) return(0);
return(parseInt(p));
}

function getStyleProp(x,prop){
if(x.currentStyle)
    return(x.currentStyle[prop]);
if(document.defaultView.getComputedStyle)
    return(document.defaultView.getComputedStyle(x,'')[prop]);
return(null);
}

function rgb2hex(value){
var hex="",v,h,i;
var regexp=/([0-9]+)[, ]+([0-9]+)[, ]+([0-9]+)/;
var h=regexp.exec(value);
for(i=1;i<4;i++){
    v=parseInt(h[i]).toString(16);
    if(v.length==1) hex+="0"+v;
    else hex+=v;
    }
return("#"+hex);
}

function Mix(c1,c2){
var i,step1,step2,x,y,r=new Array(3);
if(c1.length==4)step1=1;
else step1=2;
if(c2.length==4) step2=1;
else step2=2;
for(i=0;i<3;i++){
    x=parseInt(c1.substr(1+step1*i,step1),16);
    if(step1==1) x=16*x+x;
    y=parseInt(c2.substr(1+step2*i,step2),16);
    if(step2==1) y=16*y+y;
    r[i]=Math.floor((x*50+y*50)/100);
    r[i]=r[i].toString(16);
    if(r[i].length==1) r[i]="0"+r[i];
    }
return("#"+r[0]+r[1]+r[2]);
}
