var nrVoturi = 5;
var videoCurent = 0;
var playListCurentId = 0;

function live_suport(){
	document.getElementById('evenimente_live').className='motivHidde';
	document.getElementById('live').className='motivShow';
	document.getElementById('text_link').className='motivShow';
	document.getElementById('suport_link').className='motivHidde';
	
	document.getElementById('livetext').className='motivHidde';
	document.getElementById('livesuport').className='motivShow';
	
	return false;
}

function live_eveniment(){
	document.getElementById('evenimente_live').className='live-scroll';
	document.getElementById('live').className='motivHidde';
	document.getElementById('text_link').className='motivHidde';
	document.getElementById('suport_link').className='motivShow';
	
	document.getElementById('livetext').className='motivShow';
	document.getElementById('livesuport').className='motivHidde';	
	
	return false;
}

function incarcaPlayListLink( id ){
	window.location = "playList.php?arataPlayList="+id;
}

function valideazaFormReconcilieaza(){

	if( document.getElementById("c3")!= null && document.getElementById("c3").checked==true && document.getElementById("username").value.length == 0 ){
		alert('Alegeti username-ul pe care doriti sa-l folositi pe siteurile din reteaua GSP');
		return false;
	}

	if( document.getElementById("c3")!= null && document.getElementById("c3").checked==true && valid == 0 ){
		alert( 'Validam username-ul ales !' );
		userNameValidRec();
		return false;
	}

	if( document.getElementById("pass1").value == document.getElementById("pass2").value &&
		document.getElementById("pass1").value.length > 0 ){
		return true;
	}
	alert('Introduceti o parola valida in ambele campuri');
	return false;
}

function userNameValidRec(){

	var userN = document.getElementById('username').value;
	
	if( userN.length > 0 ){
		var param = "?ajax=da&userName="+userN;
		userNameValidAjaxRec(param);
	}
}

function userNameValidAjaxRec( param )
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 

var url="/members/reconciliere.php"+param;

xmlHttp.onreadystatechange=userNameValidAjaxChangedRec 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 


function userNameValidAjaxChangedRec() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	if( xmlHttp.responseText == 0){
		document.getElementById("userNameInvalid").className = "motivShow";
	}
	else{
		document.getElementById("userNameInvalid").className = "motivHidde";
		valid=1;
	}
 } 
}

function cautaVideoDupaData( data ){
	pagCD = 0;
	dataListD = data;

	var dat = data.replace( ':', '/' );
	dat = dat.replace( ':', '/' );

	document.getElementById("dataLista").innerHTML = dat;

	document.title = "Lista stirilor din ziua de " + dat;

	listDataNr();
}

function listDataNr(){
	var param = "?ajax=da&data="+dataListD+"&nr=da";

	listDataAjaxNr( param );
}

function listDataAjaxNr( param )
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 

var url="/videoListDate.php"+param;

xmlHttp.onreadystatechange=listDataAjaxChangedNr 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)

} 

function listDataAjaxChangedNr() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
		nrPag = xmlHttp.responseText;
		listData(0);
	}
}

function listData( fel ){
	var param = "?ajax=da&data="+dataListD+"&start="+(pagCD+fel);
	
	pagCD += fel; 

	listDataAjax( param );
}

function listDataAjax( param )
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 

var url="/videoListDate.php"+param;

xmlHttp.onreadystatechange=listDataAjaxChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)

} 

function listDataAjaxChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
		document.getElementById("thumbcontainer").innerHTML = xmlHttp.responseText;
		
		if( pagCD <= 0 ){
			document.getElementById("inap").className = 'motivHidde';
		}
		else{
			document.getElementById("inap").className = 'motivShow';	
		}
		
		if( pagCD+1 >= nrPag ){
			document.getElementById("inai").className = 'motivHidde';
		}
		else{
			document.getElementById("inai").className = 'motivShow';	
		}		
		
	}
}

function recuperareParola(){
	var email = document.getElementById('email').value;
	var param = "?ajax=da&recuperare="+email;
	
	recuperareParolaAjax( param );
}

function recuperareParolaAjax( param )
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 

var url="/recuperareParola.php"+param;

//alert(url);

xmlHttp.onreadystatechange=recuperareParolaAjaxChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 


function recuperareParolaAjaxChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	document.getElementById("recuperareParola").innerHTML = xmlHttp.responseText;
 } 
}

function emailValid(){
	var email = document.getElementById('email').value;
	
	if( email.length > 0 ){
		var param = "?ajax=da&email="+email;
		emailValidAjax(param);
	}
}

function emailValidAjax( param )
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 

var url="/signup1.php"+param;

xmlHttp.onreadystatechange=emailValidAjaxChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 


function emailValidAjaxChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	if( xmlHttp.responseText == 0){
		document.getElementById("emailInvalid").className = "motivShow";
		emailNN = 0;
	}
	else{
		document.getElementById("emailInvalid").className = "motivHidde";
		emailNN = 1;
	}
 } 
}



function userNameValidSchimba(){
	var userN = document.getElementById('username').value;
	
	if( userN.length > 0 ){
		var param = "?ajax=da&userName="+userN;
		userNameValidSchimbaAjax(param);
	}
}

function userNameValidSchimbaAjax( param )
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 

var url="/signup1.php"+param;

xmlHttp.onreadystatechange=userNameValidSchimbaAjaxChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 


function userNameValidSchimbaAjaxChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	if( xmlHttp.responseText == 0){
		document.getElementById("username_submit").className = "motivHidde";
		document.getElementById("userNameInvalid").className = "motivShow";
	}
	else{
		document.getElementById("username_submit").className = "motivShow";
		document.getElementById("userNameInvalid").className = "motivHidde";

	}
 } 
}

function userNameValid(){

	var userN = document.getElementById('username').value;
	
	if( userN.length > 0 ){
		var param = "?ajax=da&userName="+userN;
		userNameValidAjax(param);
	}
}

function userNameValidAjax( param )
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 

var url="/signup1.php"+param;

xmlHttp.onreadystatechange=userNameValidAjaxChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 


function userNameValidAjaxChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	if( xmlHttp.responseText == 0){
		document.getElementById("userNameInvalid").className = "motivShow";
		userNN = 0;
	}
	else{
		document.getElementById("userNameInvalid").className = "motivHidde";
		userNN = 1;
	}
 } 
}

function favoriteText(){
	alert( "Video-ul a fost adaugat la favorite" );
}

function stergeQuickList(){
	var param="?ajax=da&stergeQuickList=da";
	stergeQuickListAjax(param);
	arataPlayList();
}

function stergeQuickListAjax( param )
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 

var url="/arataInfo.php"+param;

xmlHttp.onreadystatechange=stergeQuickListAjaxChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 


function stergeQuickListAjaxChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 } 
}

function uploadFileAjax(){

	var param="?ajax=da&c1=123";

	uploadFileAjax1(param);
}

function uploadFileAjax1( param )
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 

var url="/videoUploadPopUp1.php"+param;

xmlHttp.onreadystatechange=uploadFileAjax1Changed 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 


function uploadFileAjax1Changed() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	alert(xmlHttp.responseText);
	
 } 
}

function arataInfoUp( )
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 

var url="/mesajUpload.php?ajax=da";

xmlHttp.onreadystatechange=arataInfoUpChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 


function arataInfoUpChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	alert(xmlHttp.responseText);
	
 } 
}

function nemultumireA(){
	document.getElementById("welcome").className = "report";
	document.getElementById("report").className = "motivShow";
	document.getElementById("nemultumire").className = "motivShow";
}

function trimiteNemultumire(){
	var nume = document.getElementById('nume').value;
	var email = document.getElementById('email').value;
	var telefon = document.getElementById('telefon').value;
	var text = document.getElementById('text').value;
	
	var param = "?ajax=da&nemultumire=da&nume="+nume+"&email="+email+"&telefon="+telefon+"&text="+text;
	nemultumireAjax(param);
	document.getElementById("nemultumire").className = "motivHidde";
	document.getElementById("report").className = "motivHidde";
}

function trimiteForm(){
	document.getElementById("trimitePrieten").className = "motivShow";
}

function trimtePrieten(){
	var email = document.getElementById("email").value;
	var text = document.getElementById("text").value;
	document.getElementById("trimitePrieten").className = "motivHidde";	
	
	var param="?ajax=da&trimte=da&email=" + email + "&text="+text+"&videoId="+video_id;
	
	trimtePrietenAjax(param);
	
	alert('Linkul video-ului a fost trimis catre prietenul cu adresa de email '+email);
}

function validFormSchimbareParola(){

	if( document.getElementById("parola").value.length==0 || 
		document.getElementById("parola2").value.length==0 ||
		document.getElementById("parola").value != document.getElementById("parola2").value
	  ) 
	  {
		alert("Asigurativa ca ati introdus parola de doua ori corect sau ca acestea nu sunt vide");
		return false;
	  }
		
	return true;	

}

function butonInactiv(){

	document.getElementById("username_submit").className = "motivHidde";

}

function validFormSchimbareUserName(){
	userNameValid();
	
	if( userNN == 0 ){
		alert("User name invalid");
		return false;
	}
	
	return true;
}

function validForm(){

	if( document.getElementById("username").value.length==0 || 
		document.getElementById("parola").value.length==0 || 
		document.getElementById("parola2").value.length==0 ||
		document.getElementById("parola").value != document.getElementById("parola2").value ||
		document.getElementById("termeni").checked == false ||
		document.getElementById("email").value.length==0
	  ) 
	  {
		alert("Datele introduse de dumneavoastra nu sunt in totalitate valide");
		return false;
	  }
		
	return true;	
}

function validFormMesaj(){

	if( document.getElementById("username").value.length==0 ||
		document.getElementById("username").value.length < 3 ){
		alert("Completati campul aferent username-ului");
		return false;		
	}
	
	if ( document.getElementById("parola").value.length==0 ){
		alert("Completati campul aferent parolei");
		return false;
	}
	
	if( document.getElementById("parola2").value.length==0 ){
		alert("Completati campul aferent confirmarii parolei");
		return false;
	}
	
	if ( document.getElementById("parola").value != document.getElementById("parola2").value ){
		alert("Parola si confirmarea parolei trebuie sa fie identice");
		return false;
	}
	
	if( document.getElementById("termeni").checked == false ){
		alert("Trebuie sa fiti de acord cu termenii si conditiile mentionate");		
		return false;	
	}
	
	if( document.getElementById("email").value.length==0 ) 
	{
		alert("Completati campul aferent email-ului");
		return false;
	}
		
	if( userNN == 0 || emailNN == 0 ){
		alert("Asigurati-va ca username-ul si email-ul sunt valide");
		return false;
	}	
		
	return true;	
}

function incarca( ){
	var param = "?ajax=da&incarca="+playListCurentId;
	incarcaAjax(param);
}

function salveazaPlayListA(){
	var param = "?ajax=da&playList=da&save=da";
	salveazaPlayListAAjax(param);
}

function arataListaPlayListuri(){
	var param = "?ajax=da";
	arataListaPlayListuriAjax(param);
}

function stergePlayList(){
	var param="?ajax=da&sterge=da&idPlayList=" + playListCurentId;
	stergePlayListAjax(param);

}

function schimbaNumePlayList(){
	
	var param="?ajax=da&playListName=" + document.getElementById("numePlayListNou").value + "&idPlayList=" + playListCurentId;
	playListNumeAjax(param);
}

function incarcaPlayList( lista, id, nume ){

	playListCurentId = id;

	document.getElementById("numeP").className = "motivShow";
	document.getElementById("numePla").innerHTML = nume+"<br />Linkul catre playlist este : /playList.php?arataPlayList="+playListCurentId;

	var param = "?ajax=da&playListI=" + lista;
	
	incarcaPlayListAjax(param);
}

function onPlayFinished(){
	if("undefined" != typeof(videoList)){
		while( videoList[videoCurent] == 0 && videoCurent < videoList.length ){
	    		videoCurent++;
		}
		if( videoList[videoCurent] != 0 && videoCurent < videoList.length ){
			playFilm( videoList[videoCurent] );
			videoCurent++;
		}
	}

}

function valideazaForm(){

	var fisierS  = document.getElementById('fisier_upload').value;

	var par = fisierS.split('.');

	if( par[1] == null || par[1]=='undefined' || 
	  (!
		( par[1] == "mov" || par[1] == "avi" || par[1] == "flv" || par[1] == "mpeg" || par[1] == "wmv" || par[1] == "mpg" || par[1] == "mp4" )
	  ) ){
		alert('Fisierul care a fost introdus nu respecta standardele noastre');
		return false;
	}

	if( document.getElementById('title').value==''){
		alert("Va rugam sa introduceti un titlu");
		return false;
	}
	
	if( document.getElementById('description').value=='' ){
		alert("Va rugam sa introduceti o descriere la video");
		return false;	
	}

	if( document.getElementById('tags').value=='' ){
		alert("Va rugam sa introduceti cel putin un tag");
		return false;	
	}

	document.getElementById("uploadAsteapta").className = "motivShow";

	return true;

}

function mouseOut( poz ){
	for( i=0; i< nrVoturi; i++ ){
		document.getElementById('img'+i).src="/images/icon-rate.gif";
	}
}

function mouseOver( poz ){
	for( i=0; i<=poz; i++ ){
		document.getElementById('img'+i).src="/images/icon-ratehover.gif";
	}
	for( i=poz+1; i< nrVoturi; i++ ){
		document.getElementById('img'+i).src="/images/icon-rate.gif";
	}
}

function voteaza( nrVot, videoId ){

	var param = "?ajax=da&userId=" + user_id + "&videoId=" + videoId + "&raiting=" + (nrVot+1);
	rateAjax(param);
}

function playFilm( vId ){
	var param = "?ajax=da&play=da&altFilm=" + vId;
	playAjax(param);
}

function scoatePlayList( cid ){

	scoateFilmPlayList( cid );

	var param = '?ajax=da&vId=' + cid;

	playListAjax(param);
	
	arataPlayList();
	
}

function scoateFilmPlayList( cid ){

	var poz = -1;

	for(i=0; i<videoList.length; i++ ){
		if( videoList[i] == cid ){
			poz = i;
			break;
		}
	}
	
	for(i=poz;i<videoList.length-1;i++){
		videoList[i] = videoList[i+1];
	}

}

function adaugaPlayList( cid ){

	var param = '?ajax=da&vId=' + cid + "&add=da";

	playListAjax(param);

}

function adaugaPlayList1( cid ){

	videoList[videoList.length-1] = cid;
	videoList[videoList.length-1] = 0;

	var param = '?ajax=da&vId=' + cid + "&add=da";

	playListAjax(param);

	arataPlayList();
}

function arataPlayList(){

	var param = '?ajax=da&playList=da';
	
	arataPlayListAjax(param);
}

function populateSubCategory( cid ){

	var param = "?ajax=da&cid=" + cid;
	
	subCategAjax(param);
}

function pagina( tip ){

	if( ( tip == -1 && nrPagCurenta == 0 ) || ( tip == 1 && nrPagCurenta + 1 == nrPagTotal ) ){
	}
	else{
	
		if( tip == -1 ){
			document.getElementById("n01").className = "motivShow";
			document.getElementById("n02").className = "motivShow";		
		}
		else{
			document.getElementById("p01").className = "motivShow";
			document.getElementById("p02").className = "motivShow";		
		}
		nrPagCurenta += tip;	
		var param = "?ajax=da&start=" + nrPagCurenta + "&tipLista="+tipLista + "&cid="+canal + "&tag="+tag + "&tip="+tipL;

		pagListAjax( param );
		
		if(nrPagCurenta == 0){
			document.getElementById("p01").className = "motivHidde";
			document.getElementById("p02").className = "motivHidde";
		}
		else
		if(nrPagCurenta + 1 == nrPagTotal){
			document.getElementById("n01").className = "motivHidde";
			document.getElementById("n02").className = "motivHidde";		
		}				
		
	}
}

function paginaGSP( tip ){

	if( ( tip == -1 && nrPagCurenta == 0 ) || ( tip == 1 && nrPagCurenta + 1 == nrPagTotal ) ){
		alert(1);
	}
	else{
	
		if( tip == -1 ){
			document.getElementById("n01").className = "motivShow";
			document.getElementById("n02").className = "motivShow";		
		}
		else{
			document.getElementById("p01").className = "motivShow";
			document.getElementById("p02").className = "motivShow";		
		}
		nrPagCurenta += tip;	
		var param = "?ajax=da&start=" + nrPagCurenta + "&tipLista="+tipLista + "&tip="+tipL;
		
		pagListAjaxGSP( param );
		
		if(nrPagCurenta == 0){
			document.getElementById("p01").className = "motivHidde";
			document.getElementById("p02").className = "motivHidde";
		}
		else
		if(nrPagCurenta + 1 == nrPagTotal){
			document.getElementById("n01").className = "motivHidde";
			document.getElementById("n02").className = "motivHidde";		
		}				
		
	}
}

function schimbaAsezare( fel ){

	tipL = fel;

	if( tipL == 0 ){
		document.getElementById("idD").className = "";
		document.getElementById("idT").className = "inactive";
	}
	else{
		document.getElementById("idD").className = "inactive";
		document.getElementById("idT").className = "";	
	}
	
	var param = "?ajax=da&start=" + nrPagCurenta + "&tipLista="+tipLista + "&cid="+canal + "&tag="+tag + "&tip="+tipL;

	pagListAjax( param );
}

function schimbaAsezareGSP( fel ){

	tipL = fel;

	if( tipL == 0 ){
		document.getElementById("idD").className = "";
		document.getElementById("idT").className = "inactive";
	}
	else{
		document.getElementById("idD").className = "inactive";
		document.getElementById("idT").className = "";	
	}
	
	var param = "?ajax=da&start=" + nrPagCurenta + "&tip="+tipL;

	pagListAjaxGSP( param );
}

function logheaza(){
	alert("Trebuie sa va logati");
}

function paginatie( tip ){

	var param = "?ajax=da&video_id=" + video_id + "&pag=";

	if( tip == -1 && pagCurenta == 0 ){
	}
	else{
		if( tip == -1 ){
			document.getElementById('p02').className = 'motivShow';
			param += --pagCurenta;
			if(pagCurenta==0){
				document.getElementById('p01').className = 'motivHidde';
			}
		}
		else{
			document.getElementById('p01').className = 'motivShow';
			param += ++pagCurenta;
			if( (pagCurenta+1) == nrPag ){
				document.getElementById('p02').className = 'motivHidde';
			}
		}
	}

	pagAjax( param );

}

function arataMotive(){
	document.getElementById('motiveAbuz').className = 'motivShow';
}

function trimiteAbuz(){
	
	var numeC = document.getElementById('nume').value;
	var emailC = document.getElementById('email').value;
	var mesaj = document.getElementById('mesaj').value;
	abuzAjax("?ajax=da&abuz=da&video_id="+video_id+"&nume="+numeC+"&email="+emailC+"&mesaj="+mesaj);

}

function arataComentariu(){
	document.getElementById('addComentariu').className = 'motivShow';
	return false;
}

function addComentariu(){
	comenteaza( document.getElementById('comentariuT').value );
}

function comenteaza( text ){
	var param = "?ajax=da&comment=" + text + "&video_id=" + video_id + "&comment_user_id=" + user_id;
	comentariuAjax( param );
}

function favoriteUser(){
	favoriteAjax("?ajax=da&favorite=da&video_id=" + video_id + "&user_id="+user_id);
}

var xmlHttp

function rateAjax( param )
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	  alert ("Browser does not support HTTP Request")
	  return
	} 
	
	var url="/viewVideo1.php" + param;

	
	xmlHttp.onreadystatechange=rateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
} 

function rateChanged () 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{	 
		document.getElementById("rateAjax").innerHTML = xmlHttp.responseText;
	} 
}

function playAjax( param )
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	  alert ("Browser does not support HTTP Request")
	  return
	} 
	
	var url="/viewVideo1.php" + param;

	
	xmlHttp.onreadystatechange=playChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
} 

function playChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{	 
		document.getElementById("filmCurent").innerHTML = xmlHttp.responseText;
	} 
}

function arataPlayListAjax( param )
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	  alert ("Browser does not support HTTP Request")
	  return
	} 
	
	var url="/viewVideo1.php" + param;

	xmlHttp.onreadystatechange=arataPlayListChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
} 

function arataPlayListChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{	 
		if( xmlHttp.responseText!= null && xmlHttp.responseText.length > 0) {
			document.getElementById("playListArata").className = "motivShow";		
			document.getElementById("pls").innerHTML = xmlHttp.responseText;	
		}
		else{
			document.getElementById("playListArata").className = "motivHidde";			
		}
		
	} 
}	

function playListAjax( param )
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	  alert ("Browser does not support HTTP Request")
	  return
	} 
	
	var url="/arataInfo.php" + param;

	
	xmlHttp.onreadystatechange=playListChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
} 

function playListChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{	 
	} 
}	

function subCategAjax( param )
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	  alert ("Browser does not support HTTP Request")
	  return
	} 
	
	var url="/videoUploadPopUp1.php" + param;

	
	xmlHttp.onreadystatechange=subCategChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
} 

function subCategChanged() 
{ 
	document.getElementById("subCategLinie").className = "motivShow"; 
	document.getElementById("subCateg").innerHTML = 'Subcategoriile ....';
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{	 
		//document.getElementById("subCategLinie").className = "motivShow";
		
		document.getElementById("subCateg").innerHTML = xmlHttp.responseText;
	} 
}	

function pagListAjaxGSP( param )
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	  alert ("Browser does not support HTTP Request")
	  return
	} 
	
	var url="/myGsp.php" + param;

	xmlHttp.onreadystatechange=pagListChangedGSP 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
} 


function pagListChangedGSP() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{	 
		document.getElementById("thumbcontainer").innerHTML = xmlHttp.responseText;
	} 
}

function pagListAjax( param )
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	  alert ("Browser does not support HTTP Request")
	  return
	} 
	
	var url="/videoList1.php" + param;

	xmlHttp.onreadystatechange=pagListChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
} 


function pagListChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{	
		//alert(xmlHttp.responseText); 
		document.getElementById("thumbcontainer").innerHTML = xmlHttp.responseText;
	} 
}	

function pagAjax( param )
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 

var url="/viewVideo1.php" + param;

xmlHttp.onreadystatechange=pagChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 


function pagChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 	document.getElementById("addCom01").innerHTML = xmlHttp.responseText;
 } 
}

function favoriteAjax( param )
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 

var url="/viewVideo1.php" + param;

xmlHttp.onreadystatechange=favoriteChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 


function favoriteChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 	alert('Video-ul a fost adaugat in lista de favorite');
 } 
}

function abuzAjax( param )
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 

var url="/viewVideo1.php" + param;
xmlHttp.onreadystatechange=abuzChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 


function abuzChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 	document.getElementById('motiveAbuz').className = 'motivHidde';
 } 
}

function comentariuAjax( param )
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 

var url="/viewVideo1.php" + param;

xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 


function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	document.getElementById('addComentariu').className = 'motivHidde';
	document.getElementById("addCom01").innerHTML = xmlHttp.responseText;
 } 
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 // Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}

function incarcaPlayListAjax( param )
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 
var url="/viewVideo1.php" + param;

xmlHttp.onreadystatechange=incarcaPlayListChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 


function incarcaPlayListChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	document.getElementById("listaPlayList").innerHTML = xmlHttp.responseText;
 } 
}

function playListNumeAjax( param )
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 
var url="/viewVideo1.php" + param;

xmlHttp.onreadystatechange=playListNumeChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 


function playListNumeChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	arataListaPlayListuri();
 } 
}

function arataListaPlayListuriAjax( param )
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 
var url="/playList.php" + param;

xmlHttp.onreadystatechange=arataListaPlayListuriAjaxChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 


function arataListaPlayListuriAjaxChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	document.getElementById("arataListaPlayList").innerHTML = xmlHttp.responseText;

	arataPlayList();
	
 } 
}

function salveazaPlayListAAjax( param )
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 
var url="/viewVideo1.php" + param;

xmlHttp.onreadystatechange=salveazaPlayListAAjaxChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 


function salveazaPlayListAAjaxChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	alert("Playlistul dumneavoastra a fost salvat");
 } 
}

function incarcaAjax( param )
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 
var url="/playList.php" + param;

xmlHttp.onreadystatechange=incarcaAjaxChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 


function incarcaAjaxChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	
 } 
}

function trimtePrietenAjax( param )
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 

var url="/viewVideo1.php" + param;


xmlHttp.onreadystatechange=trimtePrietenAjaxChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 


function trimtePrietenAjaxChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	
 } 
}

function nemultumireAjax( param )
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 

var url="/viewVideo1.php" + param;


xmlHttp.onreadystatechange=nemultumireAjaxChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 


function nemultumireAjaxChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	
 } 
}

function stergePlayListAjax( param )
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 
var url="/playList.php" + param;

xmlHttp.onreadystatechange=stergePlayListAjaxChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 


function stergePlayListAjaxChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	arataListaPlayListuri();
	document.getElementById('numeP').className = "motivHidde";
	document.getElementById('listaPlayList').innerHTML = "";
	
 } 
}

function selectText(id){
    var el = document.getElementById(id);
    el.focus();
    el.select();
}

function changePlaylist(id){
    var el = document.getElementById(id);
    eval(el.options[el.selectedIndex].value);
    if(el.options[0].value == '')
	el.options[0] = null;
}
