﻿// JavaScript Document
/*
var OpenedWindows	= new Array() ;

function OpenWindow( WindowName )
{
	var Features	= arguments[ 2 ]	== null	? ''	: arguments[ 2 ] ;

	if( WindowName == 'Operation_Document' )
		Features	= 'status=0, scrollbars=1, width=800, height=600, left=' + ( screen.width - 800 ) / 2 + ', top=' + ( screen.height - 600 ) / 2 ;

	if( WindowName == 'Operation_Document_Filter' )
		Features	= 'status=0, scrollbars=1, width=400, height=400, left=0, top=' + ( screen.height - 400 ) ;

	if( WindowName == 'Operation_Document_UPDATE' )
		Features	= 'status=0, scrollbars=1, width=400, height=600, left=' + ( screen.width - 400 ) + ', top=' + ( screen.height - 600 ) ;

	if( WindowName == 'Operation_Document_Extend' )
		Features	= 'status=0, scrollbars=1, width=400, height=100, left=' + ( screen.width - 400 ) + ', top=' + ( screen.height - 100 ) ;

	WindowName	=
	OpenedWindows[ WindowName ]	= window.open( '', WindowName, Features ) ;

	WindowName.focus() ; 

	document.body.onUnload = CloseWindows ;
}
function CloseWindows()
{
	for( WindowName in OpenedWindows )
	{
		if( !OpenedWindows[ WindowName ].closed )
		{
			OpenedWindows[ WindowName ].close() ;
		}
	}
}
*/
function $( objectID, iFrame ) {
	if( objectID == '' )
		return ;

	if( typeof( objectID ) == 'object' )
		return objectID ;

	switch( objectID ) {
		case 'body' :
			break ;
		default :
			break ;
	}

	if( !iFrame )
		return document.getElementById( objectID ) ;

	iFrame	= $( iFrame ) ;	

	return iFrame.contentWindow.document.getElementById( objectID ) ;
}

function getElementsByClass( NODE, ClassName, TagName ) {
	var CLASSs	= new array() ;

	if( !ClassName )
		return CLASSs ;

	if( !TagName )
		TagName	= '*' ;

	ELEMENTs	= document.getElementsByTagName( TagName ) ;

	for( var i	= 0; i < ELEMENTs.length; i++ ) {
		if( ELEMENTs[ i ].className == ClassName ) {
			CLASSs[ CLASSs.length ]	= ELEMENTs[ i ];
		}
	}

	return CLASSs ;
}

function formatAttribute( Attribute ) {
	switch( Attribute ) {
		case 'bgcolor' :
			Attribute	= 'bgColor';
			break ;
		case 'style.text.decoration' :
			Attribute	= 'style.textDecoration';
			break ;
		case 'style.text.align' :
			Attribute	= 'style.textAlign';
			break ;
		case 'style.vertical.align' :
			Attribute	= 'style.varticalAlign';
			break ;
		case 'style.line.height' :
			Attribute	= 'style.lineHeight';
			break ;
		case 'style.border.style' :
			Attribute	= 'style.borderStyle';
			break ;
		case 'style.border.top.style' :
			Attribute	= 'style.borderTopStyle';
			break ;
		case 'style.border.right.style' :
			Attribute	= 'style.borderRightStyle';
			break ;
		case 'style.border.bottom.style' :
			Attribute	= 'style.borderBottomStyle';
			break ;
		case 'style.border.left.style' :
			Attribute	= 'style.borderLeftStyle';
			break ;
		case 'style.border.width' :
			Attribute	= 'style.borderWidth';
			break ;
		case 'style.border.top.width' :
			Attribute	= 'style.borderTopWidth';
			break ;
		case 'style.border.right.width' :
			Attribute	= 'style.borderRightWidth';
			break ;
		case 'style.border.bottom.width' :
			Attribute	= 'style.borderBottomWidth';
			break ;
		case 'style.border.left.width' :
			Attribute	= 'style.borderLeftWidth';
			break ;
		case 'style.border.color' :
			Attribute	= 'style.borderColor';
			break ;
		case 'style.border.top.color' :
			Attribute	= 'style.borderTopColor';
			break ;
		case 'style.border.right.color' :
			Attribute	= 'style.borderRightColor';
			break ;
		case 'style.border.bottom.color' :
			Attribute	= 'style.borderBottomColor';
			break ;
		case 'style.border.left.color' :
			Attribute	= 'style.borderLeftColor';
			break ;
		case 'style.background.attachment' :
			Attribute	= 'style.backgroundAttachment';
			break ;
		case 'style.background.image' :
			Attribute	= 'style.backgroundImage';
			break ;
		case 'style.background.repeat' :
			Attribute	= 'style.backgroundRepeat';
			break ;
		case 'style.background.position' :
			Attribute	= 'style.backgroundPosition';
			break ;
		case 'style.background.position.x' :
			Attribute	= 'style.backgroundPositionX';
			break ;
		case 'style.background.position.y' :
			Attribute	= 'style.backgroundPositionY';
			break ;
		case 'style.background.color' :
			Attribute	= 'style.backgroundColor';
			break ;
		case 'style.font.family' :
			Attribute	= 'style.fontFamily';
			break ;
		case 'style.font.size' :
			Attribute	= 'style.fontSize';
			break ;
		case 'style.font.style' :
			Attribute	= 'style.fontStyle';
			break ;
		case 'style.font.weight' :
			Attribute	= 'style.fontWeight';
			break ;
		case 'style.margin.top' :
			Attribute	= 'style.marginTop';
			break ;
		case 'style.margin.right' :
			Attribute	= 'style.marginRight';
			break ;
		case 'style.margin.bottom' :
			Attribute	= 'style.marginBottom';
			break ;
		case 'style.margin.left' :
			Attribute	= 'style.marginLeft';
			break ;
		case 'style.padding.top' :
			Attribute	= 'style.paddingTop';
			break ;
		case 'style.padding.right' :
			Attribute	= 'style.paddingRight';
			break ;
		case 'style.padding.bottom' :
			Attribute	= 'style.paddingBottom';
			break ;
		case 'style.padding.left' :
			Attribute	= 'style.paddingLeft';
			break ;
		case 'style.list.style.type' :
			Attribute	= 'style.listStyleType';
			break ;
		case 'style.list.style.image' :
			Attribute	= 'style.listStylePosition';
			break ;
		case 'style.list.style.position' :
			Attribute	= 'style.listStylePosition';
			break ;
		default :
			break ;
	}

	return Attribute ;
}

function SaxonsAttributeSet( objectID, Attribute, Value, Type ) {
	object	= $( objectID ) ;

	if( !object )
		return ;

	Attribute	= formatAttribute( Attribute );

	if( !Value )
		Value	= '' ;

	if( !Type )
		Type	= '' ;

	if( Type == 'URI' )
		return ;

	if( Value != '' ) {
		switch( Type ) {
			case 'Color' :
				Value	= '#' + Value ;
				break ;
			case 'Bitmap' :
				Value	= '/_images/' + Value ;
				break ;
			default :
				break ;
		}

		switch( Attribute ) {
			case 'style.backgroundImage' :
				Value	= 'url( ' + Value + ' )' ;
				break ;
			default :
				break ;
		}
	}

	eval( 'object.' + Attribute + '= Value' );
}

var FormSumbit	= true ;

function SaxonsFormSubmit() {
	doSubmit	= FormSumbit ;
//alert( FormSumbit ) ;
	FormSumbit	= true ;

	return doSubmit ;
}

function SaxonsTagger( Tagger, Tag ) {
	Tags	= Tagger.name + '_tags' ;

	InnerHTML	= $( Tags ).innerHTML ;

	if( !Tag ) {
		FormSumbit	= false ;
		Tag	= Tagger.value ;
	} else {
		FormSumbit	= true ;
	}

	Tagger.value	= '' ;

	$( Tags ).innerHTML	= InnerHTML + '<div><input name="' + Tagger.name + '[]" value="' + Tag + '" /></div>' ;

	Tagger.form.onsubmit	= SaxonsFormSubmit ;
}