/*
Dragable window
gentoftebudoklub.dk
Copyright 2009 Aron Hjorth-Degenkolv.
*/

//Dragable window


var ns4=document.layers
var ie4=document.all
var ns6=document.getElementById&&!document.all

//drag drop function for NS 4/////////////////////////////////////

var dragswitch=0
var nsx
var nsy
var nstemp

function drag_dropns(name){
if (!ns4)
return
temp=eval(name)
temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
temp.onmousedown=gons
temp.onmousemove=dragns
temp.onmouseup=stopns
}

function gons(e){
temp.captureEvents(Event.MOUSEMOVE)
nsx=e.x
nsy=e.y
}
function dragns(e){
if (dragswitch==1){
temp.moveBy(e.x-nsx,e.y-nsy)
return false
}
}

function stopns(){
temp.releaseEvents(Event.MOUSEMOVE)
}

//drag drop function for ie4+ and NS6/////////////////////////////////////

function drag_drop(e){
if (ie4&&dragapproved){
crossobj.style.left=tempx+event.clientX-offsetx
crossobj.style.top=tempy+event.clientY-offsety
return false
}
else if (ns6&&dragapproved){
crossobj.style.left=tempx+e.clientX-offsetx
crossobj.style.top=tempy+e.clientY-offsety
return false
}
}

function initializedrag(e){
crossobj=ns6? document.getElementById("showimage") : document.all.showimage
var firedobj=ns6? e.target : event.srcElement
var topelement=ns6? "HTML" : "BODY"

while (firedobj.tagName!=topelement&&firedobj.id!="dragbar"){
firedobj=ns6? firedobj.parentNode : firedobj.parentElement
}

if (firedobj.id=="dragbar"){
offsetx=ie4? event.clientX : e.clientX
offsety=ie4? event.clientY : e.clientY

tempx=parseInt(crossobj.style.left)
tempy=parseInt(crossobj.style.top)

dragapproved=true
document.onmousemove=drag_drop
}
}
document.onmousedown=initializedrag
document.onmouseup=new Function("dragapproved=false")

////drag drop functions end here//////

function hidebox(){
if (ie4||ns6)
crossobj.style.visibility="hidden"
else if (ns4)
document.showimage.visibility="hide"
}

//----------------------------------------------//

// Dragable window

<!----------------------- dragwin(position and size) -----------------------//
var dragwin_left='5';		// Position left (100)
var dragwin_top='50';	// Position top (100)
var dragwin_width='310';	// Width in pixels (190)
var dragwin_border='1';	// Window border (1)
var dragwin_bordercolor='';	// Window bordercolor ('')

//----------------------- dragwintitle [VARIABLES] -----------------------//
var dragwintitle_txt='S&aelig;son 2009-2010';	// Title text
var dragwintitle_color='#FFFFFF';	// Text color
var dragwintitle_bg='#3399CC';	// Background color (003399/E68A00/3399CC)
var dragwintitle_fontsize='10pt';	// Font size

//----------------------- dragwinbody [VARIABLES] -----------------------//

var dragwinbody_color= '#000000';		// Text color (FFFFFF)
var dragwinbody_bg= '#ECECEC';			// Background color (BE0000/E68A00/3399CC/ECECEC/AEE4FF)
var dragwinbody_fontsize= '12pt';		// Font size
var dragwinbody_padding= '3px 3px 3px 3px';	// padding i pixels (top right bottom left)

var dragwinbody_txt= '<DIV STYLE="font-size:12pt; padding-top:3px; width:100%; background-color:#FFFFFF;" ALIGN="center"><B>S&aelig;sonsstart for NYE</B><BR>'+
'<DIV STYLE="font-size:18pt; padding-top:5px; width:100%; background-color:#FFFFFF;"><B>september og januar</B><BR></DIV>'+
'<DIV STYLE="font-size:8pt; padding-top:3px; padding-bottom:1px; width:100%; background-color:#FFFFFF;">Du kan dog starte i hele s&aelig;sonen, undtagen i maj og juni<BR></DIV>'+
'<DIV STYLE="font-size:8pt; padding-top:1px; padding-bottom:5px; width:100%; background-color:#FFFFFF;">(Se i kalenderen for n&aelig;rmere information)<BR></DIV>'+
'<DIV STYLE="font-size:8pt; padding-top:2px; padding-bottom:2px; width:100%; background-color:#D3D3D3; color:#000000;">Gratis pr&oslash;vetimer p&aring; alle hold<BR></DIV>'+
//'<DIV STYLE="font-size:10pt; padding-top:5px; padding-bottom:3px; width:100%; background-color:#FFFFFF;"><B>Selvforsvar for kvinder 2009</B><BR></DIV>'+
//'<DIV STYLE="font-size:8pt; padding-top:0px; padding-bottom:5px; width:100%; background-color:#FFFFFF;">3 måneders kursus / Start <B>09. september</B><BR>(Se under Kurser for mere info).</DIV>'+
'</DIV>';			// All lines of body text

//----------------------- dragwin(start) -----------------------//
var dragwin=
'<DIV id="showimage" style="position:absolute;width:'+ dragwin_width +
'px;left:'+ dragwin_left +';top:'+ dragwin_top +'">'+
'<TABLE bordercolor="'+ dragwin_bordercolor +'" border="'+ dragwin_border +
'" width="'+ (dragwin_width-10) +'" bgcolor="'+ dragwintitle_bg +'" cellspacing="0" cellpadding="0">'+
'<TR>'+
'<TD width="100%">'+
'<TABLE border="0" width="100%" cellspacing="0" cellpadding="2">'+
'<TR>'+
'<TD id="dragbar" style="cursor:default" width="100%">'+
'<ilayer width="100%" onSelectStart="return false">'+
'<layer width="100%" onMouseover="dragswitch=1; if (ns4) drag_dropns(showimage)" onMouseout="dragswitch=0">'+
'<SPAN STYLE="color:'+ dragwintitle_color +'; font-size:'+ dragwintitle_fontsize +'">'+
dragwintitle_txt +
'</SPAN>'+
'</layer>'+
'</ilayer>'+
'</TD>'+
'<TD><a href="#" onClick="hidebox();return false"><IMG SRC="img/luk.gif" ALT="Luk" BORDER="0" ALIGN="middle" width="15" height="15"></a></TD>'+
'</TR>'+
'<TR>'+
'<TD WIDTH="100%" COLSPAN="2" style="background:'+ dragwinbody_bg +'; color:'+ dragwinbody_color +
'; font-size:'+ dragwinbody_fontsize +'; padding:'+ dragwinbody_padding +'">'+ dragwinbody_txt+
'</TR></TABLE>'+
'</TD>'+
'</TR></TABLE>'+
'</DIV>';
//----------------------- dragwin(slut) -----------------------//
