//<script>


IS={}
IS.IE4=window.external?true:false;
IS.IE5=IS.IE4&&document.getElementById;
IS.IE55=IS.IE5&&window.createPopup;
IS.IE6=IS.IE55&&navigator.appVersion.indexOf("6.")!=-1;
IS.NS4=document.layers?true:false;
IS.MOZ=navigator.productSub>=20020530;
IS.O=typeof self.opera=="object";

// Emulation functions
if (!document.getElementById){
	if(document.all)document.getElementById=function(s){return document.all[s]}
}

function OPPCRE_include (path,type,ret)
{
	var S
	switch(type){
		case "STYLE":
			S = '<LINK REL="stylesheet" HREF="' + path + '">'
		break;
		default:
			S = '<s'+'cript defer src="' + path + '"></s'+'cript>'
		break;
	}
	if(!ret)document.write(S);
	return S
}

if (!document.getElementById) {	if(document.all) document.getElementById=function(s){ return document.all[s] } }
if((document.all&&!window.createPopup) || (document.layers))
{
//<script>
	// shift
	if(!Array.prototype.shift){
	  function array_shift() {
	      var firstElement = this[0];
	      this.reverse();
	      this.length = Math.max(this.length-1,0);
	      this.reverse();
	      return firstElement;
	  }
	  Array.prototype.shift = array_shift;
	}
	// unshift
	if(!Array.prototype.unshift){
	    function array_unshift(){
	        this.reverse();
	        for(var i=arguments.length-1; i>=0; i--){
	            this[this.length] = arguments[i];
	        }
	        this.reverse();
	        return this.length
	    }
	    Array.prototype.unshift = array_unshift;
	}
	// push
	if(Array.prototype.push && ([0].push(true)==true)) Array.prototype.push = null;
	if(!Array.prototype.push){
	    function array_push(){
	        for(var i=0, al=arguments.length;i<al;i++){
	            this[this.length]=arguments[i]
	        };
	        return this.length;
	    }
	    Array.prototype.push = array_push;
	}
	// pop
	if(!Array.prototype.pop){
	    function array_pop(){
	        var lastElement = this[this.length-1];
	        this.length = Math.max(this.length-1,0);
	        return lastElement;
	    }
	    Array.prototype.pop = array_pop;
	}
	// splice
	if(Array.prototype.splice && typeof([0].splice(0))=="number") Array.prototype.splice = null;
	if(!Array.prototype.splice){
	    function array_splice(ind,cnt){
	        if(arguments.length == 0) return ind;
	        if(typeof ind != "number") ind = 0;
	        if(ind < 0) ind = Math.max(0,this.length + ind);
	        if(ind > this.length) {
	            if(arguments.length > 2){ ind = this.length } else { return [] }
	        }
	        if(arguments.length < 2) cnt = this.length-ind;
	        cnt = (typeof cnt == "number") ? Math.max(0,cnt) : 0;
	        var removeArray, endArray
	        removeArray = this.slice(ind,ind+cnt);
	        endArray = this.slice(ind+cnt);
	        this.length = ind;
	        for(var i=2, al=arguments.length;i<al;i++){
	            this.push(arguments[i]);
	        }
	        for(var i=0, el=endArray.length;i<el;i++){
	            this.push(endArray[i]);
	        }
	        return removeArray;
	    }
	    Array.prototype.splice = array_splice;
	}

// OPPCRE_include('/site/array.js'); // Array methods for pre-5.5
}



OPPCCT={} // Client Communication Tools
OPPCCT.MSXML = ["Msxml2.XMLHTTP","Microsoft.XMLHTTP"]
OPPCCT.OldJS = "/site/cctold.js"
OPPCCT.dummyPic = new Image();
OPPCCT.fetchQueue = [];
OPPCCT.maxFetches = 3;
OPPCCT.curFetches = 0;
OPPCCT.fetchDelay = 200;
OPPCCT.makeRequest = function(sURL,cache){
	//var P = new Image();
	OPPCCT.dummyPic.src = cache ? sURL : OPPCCT.appendNoCache(sURL)
}

OPPCCT.fetch = function(url,CB,noCache){
	if(noCache) url = OPPCCT.appendNoCache(url);

	var newCB = function(sData){
		//alert(OPPCCT.curFetches);
		CB(sData);
		setTimeout("OPPCCT.queueDone();", OPPCCT.fetchDelay );
	}

	OPPCCT.queueFetching( url, newCB );
	OPPCCT.queueCheck();
}

OPPCCT.retrieveURL = function(url,CB){

	if(typeof XMLFETCH!="undefined")return XMLFETCH(url,CB);
	if(typeof IEFETCH!="undefined")return IEFETCH(url,CB);
	if(typeof OLDFETCH!="undefined")return OLDFETCH(url,CB);
}

OPPCCT.NewXMLHTTP=function(bExp){
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
	var MSXML = null;
	try{
		MSXML = new ActiveXObject(OPPCCT.MSXML[0]);
	}catch(e){
		try{
			if(bExp) MSXML = new ActiveXObject(OPPCCT.MSXML[1]);
		}catch(e){}
	}
	return MSXML;
@end @*/
	if(typeof XMLHttpRequest!="undefined"){
		return new XMLHttpRequest();
	}
}

OPPCCT.preInit=function(){
	if(OPPCCT.NewXMLHTTP()){
		XMLFETCH=function(url,CB){
			var P = OPPCCT.NewXMLHTTP(), done=false;
			P.open("GET",url,true);
			P.onreadystatechange=function(){
				if(P.readyState==4 && !done){
					done = true;
					CB(P.responseText);
				}
			}
			P.send(null);
		}
	}
	if(self.IS&&IS.IE5){
		document.write('<span style="display:none;behavior:url(#default#download)" id="IEDOWN"></span>')
		IEFETCH = function(url,CB){
alert('hello');
			return IEDOWN.startDownload(url,CB);
		}
		return;
	}
	if(self.XMLFETCH||self.IEFETCH)return;
	// IE4 & NS4, old fallback solution
//	if(self.OPPCRE) 
        OPPCRE_include(OPPCCT.OldJS);
}

OPPCCT.sFunction = function(sID)
{
 return new Function("data","var id='" + sID + "';"+mysFunction);
}



OPPCCT.correctLinks = function(S){
/*@cc_on @*/
	var r = /(<\s*(a|area|form)\s)/gi
/*@if (@_jscript_version >= 5.5)
	r = /(<\s*(a|area|form)\s)(?!.*target\s*=)/gi
@end @*/
	return S.replace(r,'$1target="_blank" ') // Open in new windows
}
OPPCCT.correctScript = function(S){
	var rFunc = /(function)\s(\w+)\(/g
	var sRep = "$2=$1("
	S = S.replace(rFunc, sRep);
	//alert(S)
	return S;
}

OPPCCT.loadScript = function(sURL, sLoad, noCache){
	if(OPPCRE_include){
		//alert(sURL)
		OPPCRE_include( !noCache ? sURL : OPPCCT.appendNoCache(sURL) );
		//eval(sLoad);
	} else {
		//alert(sURL + "\n" + noCache)
		var sFunc = "var a=new Function(OPPCCT.correctScript(S));a();" + sLoad;
		var CB = new Function("S",sFunc);
		//sURL = '/sc_lib/getScript.sc?scriptsource='+sURL
		//sURL = + escape(sURL);
		OPPCCT.fetch( sURL, CB, noCache );
	}
}


OPPCCT.queueFetching = function(sURL,oCB){ // Append to the fetch queue
	var qObj = {sURL:sURL,oCB:oCB};
	OPPCCT.fetchQueue.push( qObj );
}
OPPCCT.queueCheck = function(){ // Check the fetch queue
	if( OPPCCT.curFetches >= OPPCCT.maxFetches ) return;
	var qObj = OPPCCT.fetchQueue.shift();
	if(qObj){
		OPPCCT.curFetches++;
		OPPCCT.retrieveURL( qObj.sURL, qObj.oCB );
	}
}

OPPCCT.appendNoCache = function(url){
	var R = (new Date()).getTime();
	return url + (url.indexOf("?")>=0 ? "&" :"?") + "XC="+R;
}

OPPCCT.queueDone = function(){ // Prepare for next queue entry
	OPPCCT.curFetches--;
	OPPCCT.queueCheck();
}


OPPCCT.fetchNowUrl = function(url,recivefunctionid,noCache)
{
 var F = OPPCCT.sFunction(recivefunctionid);
 if(typeof url=="undefined")
  alert("error: OPPCCT.fetchNowUrl(typeof url==undefined,recivefunctionid="+recivefunctionid+",noCache="+noCache+")");
 // url = Paths_GetURL + articleid;
 OPPCCT.fetch(url,F,noCache);
 return false;
}

//setInterval("OPPCCT.makeRequest(Paths_KeepSession)",1000*60*5);
