function Line(x1,y1,x2,y2,x3,y3,x4,y4)
{
	this.id = getNewID();
	
	this.pointactv = new Image(); 
	this.pointactv.src = PICPATH+'punkt_red.gif'; 
	
	this.pointstd = new Image(); 
	this.pointstd.src = PICPATH+'punkt_grey.gif'; 
	
	this.coloractv='#E71029';
	this.colorstd='#808080';
	
	this.x1 = x1;
	this.y1 = y1;
	this.x2 = x2;
	this.y2 = y2;
	this.x3 = x3;
	this.y3 = y3;
	this.x4 = x4;
	this.y4 = y4;
	
	//methoden
	this.create = LineCreate;
	this.show = LineShow;
	this.hide = LineHide;
	this.activate = LineActivate;
	this.deactivate = LineDeactivate;
	
	// private
	this.createLine = LineCreateLine;
	this.createVertLine = LineCreateVertLine;
	this.createHorLine = LineCreateHorLine;
}

function LineCreate(id,target)
{
	var picy = this.y1 - 8;
	var picx = this.x1 - 8;
	
	document.write('<div id="'+this.id+'" style="position:absolute;top:0px;left:0px;">'); // huelle
	
	document.write('<div style="position:absolute; top:'+picy+'px; left:'+picx+'px; width:10px; height:10px; z-index:100;" ');
	
	document.write('onmouseover="menuMouseOver('+id+')"');
	document.write('onmouseout="menuMouseOut('+id+')"');
	
	if (target != null)
		document.write('onclick="link(\''+target+'\')"');
		
	document.write('>');  
	document.write('<img src="'+this.pointstd.src+'"/></div>');
	
	
	this.createLine(this.x1,this.y1,this.x2,this.y2);
	this.createLine(this.x2,this.y2,this.x3,this.y3);
	
	if( this.x4 != null ) // 3 linien
	{
		this.createLine(this.x3,this.y3,this.x4,this.y4);
	}
	
	document.write('</div>');
}

function LineCreateLine(x1,y1,x2,y2)
{
	if (x1 == x2)
		this.createVertLine(x1,y1,y2);
	else
		this.createHorLine(x1,x2,y1);
}
	
function LineCreateVertLine(x,y1,y2)
{
	var min = Math.min(y1,y2);
	document.write('<div style="position:absolute; top:'+min+'px; left:'+(x-1)+'px; width:3px; height:'+Math.abs(y2-y1)+'px; background-color:#FFFFFF; z-index:98;"><!-- --></div>');
	document.write('<div style="position:absolute; top:'+min+'px; left:'+x+'px; width:1px; height:'+Math.abs(y2-y1)+'px; background-color:'+this.colorstd+'; z-index:99;"><!-- --></div>');
}

function LineCreateHorLine(x1,x2,y)
{
	var min = Math.min(x1,x2);
	document.write('<div style="position:absolute; top:'+(y-1)+'px; left:'+(min)+'px; width:'+Math.abs(x2-x1)+'px; height:3px; background-color:#FFFFFF; z-index:98;"><!-- --></div>');
	document.write('<div style="position:absolute; top:'+y+'px; left:'+min+'px; width:'+Math.abs(x2-x1)+'px; height:1px; background-color:'+this.colorstd+'; z-index:99;"><!-- --></div>');
}

function LineShow()
{
	var node = document.getElementById(this.id).childNodes;
	
	node[1].style.visibility='visible';
	node[2].style.visibility='visible';
	node[3].style.visibility='visible';
	node[4].style.visibility='visible';
	
	if( this.x4 != null ) // 3 linien
	{
		node[5].style.visibility='visible';
		node[6].style.visibility='visible';
	}
}

function LineHide()
{
	var node = document.getElementById(this.id).childNodes;
	
	node[1].style.visibility='hidden';
	node[2].style.visibility='hidden';
	node[3].style.visibility='hidden';
	node[4].style.visibility='hidden';
	
	if( this.x4 != null ) // 3 linien
	{
		node[5].style.visibility='hidden';
		node[6].style.visibility='hidden';
	}
}

function LineActivate()
{
	var node = document.getElementById(this.id).childNodes;
	
	node[0].firstChild.src = this.pointactv.src;
	
	node[2].style.backgroundColor=this.coloractv;
	node[4].style.backgroundColor=this.coloractv;
	
	if( this.x4 != null ) // 3 linien
	{
		node[6].style.backgroundColor=this.coloractv;
	}
}

function LineDeactivate()
{
	var node = document.getElementById(this.id).childNodes;
	
	node[0].firstChild.src = this.pointstd.src;
	
	node[2].style.backgroundColor=this.colorstd;
	node[4].style.backgroundColor=this.colorstd;
	
	if( this.x4 != null ) // 3 linien
	{
		node[6].style.backgroundColor=this.colorstd;
	}
}