		
		function Hide(Cell){
		var myCell = document.getElementById(Cell);
		myCell.style.display = "none"
		}
		function Show(Cell){
		var myCell = document.getElementById(Cell);
		myCell.style.display = "";
}
function ChangeCell(Cell)
{
var myCell = document.getElementById(Cell);
myCell.style.background="gainsboro"
}
function ChangeBack(Cell)
{
var myCell = document.getElementById(Cell);
myCell.style.background="none"
}



// AJAX STAFF
function createRequestObject() {
    var ro;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer"){
        ro = new ActiveXObject("Microsoft.XMLHTTP");
    }else{
        ro = new XMLHttpRequest();
    }
    return ro;
}


var http = createRequestObject();

function changeSStory() // formNumber -y arajzhm chenq ogtagorcum
{
	http.open('get', '/ajax/changeSStory.php?cahkiller=' + Math.floor(Math.random( ) * 5 - 15 + 1) + 15 );
	http.onreadystatechange = changeSStoryReady;
	http.send(null);
	
	setTimeout( "changeSStory()", 20000 );
}

function changeSStoryReady()
{
	if(http.readyState == 4)
	{
		if( http.responseText != '' )
		{
			document.getElementById('sStoryContainer').innerHTML = http.responseText;
		}
	}
}

function siteMap() // formNumber -y arajzhm chenq ogtagorcum
{
	document.getElementById('siteMap').style.display = 'block';
	/*
	http.open('get', '/ajax/siteMap.php' );
	http.onreadystatechange = siteMapReady;
	http.send(null);
	*/
}


function xmlhttpPost(strURL, idx, p) 
{
	
	var xmlHttpReq = false;
    var self = this;
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest(); 
    }
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); 
    }
   
    self.xmlHttpReq.open('POST', strURL, true); 
    
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    
    self.xmlHttpReq.onreadystatechange = function() {
    	
        if (self.xmlHttpReq.readyState == 4) {
        	
            updatepage(self.xmlHttpReq.responseText, idx, p);  
        }
    }
    self.xmlHttpReq.send(getquerystring(idx, p));
    
    
}


function open_close(id) 
{
	
	var doc_id = 'v_'+id;
	if( document.getElementById(doc_id).style.display == 'block' )
	  {
	  	document.getElementById(doc_id).style.display = 'none';
	  }
	  else
   xmlhttpPost("/video_tube.php", "v", id);
     
}


function getquerystring(idx, p) 
{
	if(idx=="v")
	{
		
		var obj_zoom = document.getElementById('v_' + p);
		obj_zoom.className='tdalpha';
		
		var doc_id = idx + '_' + p;
		var x1 = document.getElementById(doc_id).value;
		qstr = 'x1=' + escape(x1) + '&x2=' + escape(p);
		//alert(qstr);
		
	}
	return qstr;
}
function updatepage(str, idx, p)
{
	
	if(idx == "v")
	{
		
		var ids = document.getElementById('id_arr').value;
		
		var id_arr = new Array();
		id_arr = ids.split('***');
		
		var td_id;
		for(var i=0; i<id_arr.length; i++)
		{
			td_id = 'v_'+id_arr[i];
			document.getElementById(td_id).style.display='none';
		}
		

		var doc_id = 'v_'+p;
		document.getElementById(doc_id).style.display = 'block';
	  	document.getElementById(doc_id).innerHTML = str;
	  
	  
		var obj_zoom = document.getElementById('tbl_id');
		obj_zoom.className='tdnonalpha';
	}
}

// END AJAX STAFF

