// JavaScript Document
function DOS_Common(){
	slideArray=new Array()
	this.browser={}
	this.browser.info=navigator.userAgent;
	this.browser.isChrome=this.browser.info.match(/Chrome/)
	this.browser.isOpera=this.browser.info.match(/Opera/)
	this.browser.isSafari=this.browser.info.match(/Safari/)&&!this.browser.isChrome
	this.browser.isIE=document.all&&!this.browser.isOpera;
	}
	
DOS_Common.prototype={
	isCompatible : function(other){
		if(other===false || !Array.prototype.push || ! Object.hasOwnProperty || !document.createElement || !document.getElementsByName){
			return false;
			}
		return true;
		},
		
	$ : function(){
		var elements= new Array();
		for(i=0;i<arguments.length;i++){
			var element=arguments[i];
			if(typeof element=='string'){
				element=document.getElementById(element);
				}
			if(arguments.length==1) return element;
			elements.push(element);
			}
		return elements;
		},
		
	addEvent : function ( node, type, listener ) {
		if(!DOS.isCompatible()) { return false }
		if(!(node = DOS.$(node))) return false;
		if (node.addEventListener) {
			node.addEventListener( type, listener, false );
			return true;
		} 
		else if(node.attachEvent) {
			node['e'+type+listener] = listener;
			node[type+listener] = function(){node['e'+type+listener]( window.event );}
			node.attachEvent( 'on'+type, node[type+listener] );
			return true;
		}
		return false;
		},
		
		
	addOnload : function(listener) {
		DOS.addEvent(window, 'load', listener)
		},
		
	creatAjaxRequest : function(){
		var request=false;
		try {
			request=new XMLHttpRequest();
			}
		catch(trymicrosoft){
			try{
				request=new ActiveXObject('Msxml2.XMLHTTP');
				}
			catch(othermicrosoft){
				try{
					request=new ActiveXObject('Microsoft.XMLHTTP')
					}
				catch(failed){
					request=false;
					}
				}
			}
		if(!request) alert('Your Browser does not support Ajax')
		return request
		},
		
	getCurrentOpacity : function(image,defaultValue){
		if(DOS.browser.isIE){
		var opacityCurrent=image.style.filter||'alpha(opacity='+defaultValue*100+')';
		var patt=new RegExp('alpha\\u0028opacity=(.*)\\u0029');
		opacityCurrentNum=opacityCurrent.replace(patt,'$1')/100;
		}
		else {opacityCurrentNum=image.style.opacity||defaultValue;}
		if(!opacityCurrentNum){opacityCurrentNum=1}
		return parseFloat(opacityCurrentNum)
		},
		
	fading : function(currentValue,defaultValue,toValue,onetimeValue,image){
		var currentValue=currentValue?currentValue+onetimeValue:this.getCurrentOpacity(image,defaultValue)+onetimeValue
		if(this.browser.isIE){
			image.style.filter='alpha(opacity='+currentValue*100+')';
			}
		else {image.style.opacity=currentValue;}
		}

	}
var DOS=new DOS_Common;
