function ot1ShowImgSwap( strId, intSwap ) {
	// assumes 2 images: image.gif and image_over.gif
	var imgObj = document.getElementById( strId );
	var strTemp = imgObj.src;
	var intStrLength = strTemp.length;
	var intChop, strEnd; 
	
	if ( intSwap ) {
		if (strTemp.indexOf('_over.gif') == -1) {
			intChop = intStrLength - 4;	
			strEnd = '_over.gif';
		}
	} else {
		if (strTemp.indexOf('_over.gif') > -1) {	
			intChop = intStrLength - 9;	
			strEnd = '.gif';
		}
	}
	
	if (typeof(intChop) != "undefined") {
		strTemp = strTemp.substring( 0, intChop );
	}
	
	if (typeof(strEnd) != "undefined") {
		imgObj.src = strTemp + strEnd;
	}	
}


function ot1ImgSwap( strId, intSwap ) {
	ot1ShowImgSwap( strId, intSwap );
}
var ot1AnimationValue = 10;
var ot1AnimationInterval = 40;

		function ot1PipeContainer()
		{
			this.ot1CollapseNodeID = 0;		
			this.ot1ExpandNodeID = 0;
			this.ot1PipeLineModuleMaxRowHeight = 78;
			this.ot1PipeLineModuleMinRowHeight = 24;
			this.ot1CollapsedRowHeight = 34;
			this.ot1ExpandedRowHeight = 68;
			this.tzImageObjbArr = new Array();		
			this.heightAdjustObjbArr = new Array();
			this.containerArr = new Array();
			this.idArr = new Array();
			this.idExpansionStatus = new Array();
			this.numIds = 0;
			this.dataUrl = '';
			this.refreshRate = 1000;
			this.objName = '';
			this.iframeObj = false;
			this.domParserAX = false;
			this.parseHandler = new Function();
			
		}
		function ot1PipeContainer_setObjName(objName)
		{
			this.objName = objName;
		}
		ot1PipeContainer.prototype.setObjName = ot1PipeContainer_setObjName;
		
		function ot1PipeContainer_setParsingFunction(func)
		{
			this.parseHandler = func;
		}
		ot1PipeContainer.prototype.setParsingFunction = ot1PipeContainer_setParsingFunction;

		function ot1PipeContainer_setRefreshRate(time) // in seconds
		{
			this.refreshRate = time*1000;		
		}
		ot1PipeContainer.prototype.setRefreshRate = ot1PipeContainer_setRefreshRate;
		
		function ot1PipeContainer_addContainer(id,height)
		{
			if (document.getElementById(id)) {
				document.getElementById(id).style.height = "24px";
			}
			this.idArr[this.idArr.length] = id;
			this.containerArr[this.containerArr.length] = document.getElementById(id);
			this.heightAdjustObjbArr[this.heightAdjustObjbArr.length] = document.getElementById( id );

			this.tzImageObjbArr[this.tzImageObjbArr.length] = document.getElementById(id +'Image');			
			
			this.idExpansionStatus[this.idExpansionStatus.length] = false;
			this.numIds++;
			if (height) {
				this.ot1PipeLineModuleMaxRowHeight = height;
				this.ot1ExpandedRowHeight = this.ot1PipeLineModuleMaxRowHeight;				
			}
		}
		ot1PipeContainer.prototype.addContainer = ot1PipeContainer_addContainer;

		function ot1PipeContainer_zipNode(id)
		{
			for(var i=0;i<this.numIds;i++)
			{

				if(id==this.idArr[i])
				{
					if(this.idExpansionStatus[i])
					{
						this.privateCollapseNode( i );
					}
					else
					{
						this.privateExpandNode( i );
					}
				}else
				{
					if(this.idExpansionStatus[i])
					{
						this.privateCollapseNode( i );
					}
				}
			}
		}
		ot1PipeContainer.prototype.zipNode = ot1PipeContainer_zipNode;
			var ot1ClassValue = '';

		function ot1PipeContainer_ot1CollapseNode(which) {
			if (this.ot1ExpandedRowHeight > this.ot1PipeLineModuleMinRowHeight ) {
				document.getElementById(which.id).style.height = this.ot1ExpandedRowHeight;	
			} else {
				document.getElementById(which.id).style.height = this.ot1PipeLineModuleMinRowHeight;			
				window.clearInterval(this.ot1CollapseNodeID);
				this.ot1CollapseNodeID = 0;
				this.ot1ExpandedRowHeight = this.ot1PipeLineModuleMaxRowHeight;
				if(document.getElementById(which.id+'Image') && document.getElementById(which.id+'Image').lowsrc) {
					document.getElementById(which.id+'Image').src = 'http://statik.ototurk.com/imgDiv/1.gif';
				}
			}
				this.ot1ExpandedRowHeight = this.ot1ExpandedRowHeight-ot1AnimationValue;

		}
ot1PipeContainer.prototype.ot1CollapseNode = ot1PipeContainer_ot1CollapseNode;	
			
		function ot1PipeContainer_privateCollapseNode(item)
		{
		
		if (this.ot1CollapseNodeID == 0) {
			this.ot1CollapseNodeID = window.setInterval(this.objName+".ot1CollapseNode("+this.objName+".heightAdjustObjbArr["+item+"])",ot1AnimationInterval);

			this.idExpansionStatus[item]=false;
		
			ot1ClassValue=eval(this.objName+".containerArr[ "+item+" ].className.replace(new RegExp(\"ot1PipelineExpanded\"), \"ot1PipelineCollapsed\")");
			
			ot1ClassValue=ot1ClassValue.replace(new RegExp(" ot1Over"), "");			
			
			window.setTimeout(this.objName+".containerArr[ "+item+" ].className='"+ot1ClassValue+"';",500);


		}
		}	
		ot1PipeContainer.prototype.privateCollapseNode = ot1PipeContainer_privateCollapseNode;			

function ot1PipeContainer_ot1ExpandNode(which) {
	if (this.ot1CollapsedRowHeight <= this.ot1PipeLineModuleMaxRowHeight) {
		document.getElementById(which.id).style.height = this.ot1CollapsedRowHeight;
	} else {
		document.getElementById(which.id).style.height = this.ot1PipeLineModuleMaxRowHeight;
		window.clearInterval(this.ot1ExpandNodeID);
		this.ot1ExpandNodeID = 0;
		this.ot1CollapsedRowHeight = this.ot1PipeLineModuleMinRowHeight;
	}

	this.ot1CollapsedRowHeight = this.ot1CollapsedRowHeight+ot1AnimationValue;
}
ot1PipeContainer.prototype.ot1ExpandNode = ot1PipeContainer_ot1ExpandNode;

		function ot1PipeContainer_privateExpandNode(item)
		{
			var realId = this.idArr[item]+'Image';
			if(document.getElementById(realId))
			{
				if (document.getElementById(realId).lowsrc){
					document.getElementById(realId).src = document.getElementById(realId).lowsrc;
				}
			}
			if (this.ot1ExpandNodeID == 0) {
			this.ot1ExpandNodeID = window.setInterval(this.objName+".ot1ExpandNode("+this.objName+".heightAdjustObjbArr["+item+"])",ot1AnimationInterval);
			this.idExpansionStatus[item] = true;


			this.containerArr[ item ].className =  this.containerArr[ item ].className.replace(new RegExp(" ot1Over"), "");
			this.containerArr[ item ].className =  this.containerArr[ item ].className.replace(new RegExp("ot1PipelineCollapsed"), "ot1PipelineExpanded");
//			window.setTimeout(this.objName+".idExpansionStatus["+item+"]=true;",500);
			}
		}	
		ot1PipeContainer.prototype.privateExpandNode = ot1PipeContainer_privateExpandNode;			


		

function OT1_changeBackground(which, val) {
	switch (val) {
		case 1:
			which.className += " ot1Over";
			break;
		case 0:
			which.className=which.className.replace(new RegExp(" ot1Over\\b"), "");
			break;
	}

}
		
function OT1_initVideoModules(){
	var oto1VidContainers = document.getElementById("ot1Oto1videoModule").getElementsByTagName("div");
	for (var i=0; i<oto1VidContainers.length; i++){
		var oto1VidContainer = oto1VidContainers[i];
			if(oto1VidContainer.id.substr(0,11) == "oto1VidCntr") {
				oto1VidContainer.onmouseover = function () {OT1_changeBackground(this,1); return false;}
				oto1VidContainer.onmouseout = function () {OT1_changeBackground(this,0); return false;}	
			}
			if(oto1VidContainer.id.substr(0,21) == "ot1oto1VidHeadlineBar") {
				oto1VidContainer.id = oto1VidContainer.id.replace(new RegExp("ot1oto1VidHeadlineBar"), "");
				oto1VidContainer.onclick = function () {oto1VidCntr.zipNode("oto1VidCntr"+this.id); return false;}
			}	
	}
	var oto1VidMPContainers = document.getElementById("ot1Oto1videoMPModule").getElementsByTagName("div");
	for (var i=0; i<oto1VidMPContainers.length; i++){
		var oto1VidMPContainer = oto1VidMPContainers[i];
			if(oto1VidMPContainer.id.substr(0,13) == "oto1VidMPCntr") {
				oto1VidMPContainer.onmouseover = function () {OT1_changeBackground(this,1); return false;}
				oto1VidMPContainer.onmouseout = function () {OT1_changeBackground(this,0); return false;}	
			}
			if(oto1VidMPContainer.id.substr(0,23) == "ot1oto1VidMPHeadlineBar") {
				oto1VidMPContainer.id = oto1VidMPContainer.id.replace(new RegExp("ot1oto1VidMPHeadlineBar"), "");
				oto1VidMPContainer.onclick = function () {oto1VidMPCntr.zipNode("oto1VidMPCntr"+this.id); return false;}
			}	
	}
}		
function OT1_flipModule(show,hide) {
	if (document.getElementById) {
		document.getElementById(hide).style.display = "none";
		document.getElementById(show).style.display = "block";
	}
}