function open(url) {
var load = window.open(url,'','scrollbars=no,menubar=no,height=600,width=800,resizable=yes,toolbar=no,location=no,status=no');
}
function postwith (to,p) {
  var myForm = document.createElement("form");
  myForm.method="post" ;
  myForm.action = to ;
  for (var k in p) {
    var myInput = document.createElement("input") ;
    myInput.setAttribute("name", k) ;
    myInput.setAttribute("value", p[k]);
    myForm.appendChild(myInput) ;
  }
  document.body.appendChild(myForm) ;
  myForm.submit() ;
  document.body.removeChild(myForm) ;
}
//ajax->start()
function getHTTPObject(){

 if (window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP");

 else if (window.XMLHttpRequest) return new XMLHttpRequest();

 else {

 alert("Your browser does not support AJAX.");

 return null;

 }

 }

function mkhash( )
{
  var ret = new Object( );
  for (var i = 0; i < arguments.length; ++i )
  {
    ret[arguments[i][0]] = arguments[i][1];
  }
  return ret;
}

//var myhash = eval( 'mkhash( [ "name", "matt" ], [ "age", "22" ] )' );


 // Change the value of the outputText field

 function setOutput(){

	 if(httpObject.readyState == 4){
	 	
	// var test=httpObject.responseText.split(",");
	// document.getElementById('outputText').value = test[0];
	// document.getElementById('testdiv').innerHTML = test[1];
		var fromServer=httpObject.responseText.split(",");
		imageNav(fromServer[0]);
//		document.getElementById('didik-nav').innerHTML ="<a href=\"javascript:doWork("+(fromServer[0]-1)+",'prev');\">prev</a>&nbsp;&nbsp;&nbsp;<a href=\"javascript:doWork("+fromServer[0]+",'next');\">next</a>";
		document.getElementById('didik-main-youtube').innerHTML ='<object width="100" height="344"><param name="movie" value="'+fromServer[1]+'"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="'+fromServer[1]+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="250" height="200"></embed></object>';// fromServer[1];
	 }

 }

 function imageNav(curr){
 	var s="didik/images/";
 	if(curr<=0){
 		s+="prev.gif";
 	}else{
 		s+="prev_h.gif";
 	}
 	document.getElementById('didik-nav').innerHTML ="<a href=\"javascript:doWork("+(curr-1)+",'prev');\"><img src=\""+s+"\" border=\"0\"></img></a>&nbsp;&nbsp;&nbsp;<a href=\"javascript:doWork("+curr+",'next');\"><img src=\"didik/images/next_h.gif\" border=\"0\"></img></a>";
 }
  

 // Implement business logic
//
// function doWork(){
//
// httpObject = getHTTPObject();
//
// if (httpObject != null) {
//
// httpObject.open("GET", "didik-youtube.php?inputText="
//
// +document.getElementById('inputText').value, true);
// 
//
// httpObject.send(null);
//
// httpObject.onreadystatechange = setOutput;
//
// }
//
// }
 
 function doWork(id,operation){

	 httpObject = getHTTPObject();
	
	 if (httpObject != null) {
	
		 httpObject.open("GET", "didik/didik-youtube.php?id="+id+"&operation="+operation, true);
		 
		
		 httpObject.send(null);
		
		 httpObject.onreadystatechange = setOutput;
	
	 }

 }

  

 var httpObject = null;
 //ajax->end();
//javascript:postwith('',('txtCaption':document.getElementById('txtTitle'),'txtUrl':document.getElementById('txtUrl')));