function executeDB(sql){
		var processScriptUrl=baseurl+'ajax/myphpajax.php';
		cp.call(processScriptUrl,'executeDB',return_value,sql);
	
}
	
function return_value(result){
		dbreport=result.getElementsByTagName('dbreport').item(0).firstChild.data;
		if (dbreport=='1'){
			recordcount=result.getElementsByTagName('recordcount').item(0).firstChild.data;
			coloumcount=result.getElementsByTagName('coloumcount').item(0).firstChild.data;

				for( i=0;i<recordcount;i++){
					dbArray[i]=new Array(recordcount);
					for( ii=0;ii<coloumcount;ii++){
						dbArray[i][ii]=result.getElementsByTagName('dbvalue'+i+ii).item(0).firstChild.data;															
					}
				}	
		}


dbLoaded = false;
							
															
}
	function insertInToTable(tblId, varRow, varCell, varData){
		try{
			var x=document.getElementById(tblId).rows[varRow].cells;
			x[varCell].innerHTML=varData;
			return false;
		}
		catch(Err){
			return false;
		}
	}

	function txtBoxValidation(myId,defaultColor,errColor){
		try{	
			me=document.getElementById(myId);

			if(me.value==""){	
				me.style.background=errColor;
				me.setFocus;
				return false;
			}
			else{
				me.style.background=defaultColor;
				me.setFocus;
				return true;
			}
		}
		catch(Err){
			return 'Err';
		}
	}

function hideMe(myId){
	document.getElementById(myId).style.display="none";
	
}

function showMe(myId){
	document.getElementById(myId).style.display="block";
	
}

function directMyvalueto(myValue,thatId){
	document.getElementById(thatId).value=myValue;
}

// Send Offer Begin
function fxSendOffer(hidethisdiv,minoffer,userid,videoid)
{
	hideMe('oerrors');
	hideMe('otlError');
	hideMe('gError');
	youroffer2=document.getElementById('youroffer').value;
	offerhours2=document.getElementById('offerhours').value;
	if(youroffer2>=minoffer)
	{
		hideMe('momain');
		cp.call(baseurl+'/ajax/myajaxphp.php','send_offer',send_offer_response,youroffer2,offerhours2,userid,videoid);
	}
	else
	{
		showMe('oerrors');
		showMe('otlError');
	}	
}

function send_offer_response(soresult)
{
	if(soresult.getElementsByTagName('somsg').item(0).firstChild.data==0)
	{
		showMe('oerrors');
		showMe('gError');
	}
	else
	{
		showMe('osuccess');
	}
}
// Send Offer End

// Video Comment Begin
function fxVideoComment(hidethisdiv,commentarea,userid,videoid)
{
	commentdetails=document.getElementById(commentarea).value;
	if(commentdetails=='')
	{
		showMe('addcommentError');
	}
	else
	{
		hideMe(hidethisdiv);
		hideMe('addcommentError');
		cp.call(baseurl+'/ajax/myajaxphp.php','video_comments',video_comment_response,commentdetails,userid,videoid);
	}	
}

function video_comment_response(vcomresult)
{
	if(vcomresult.getElementsByTagName('vcommsg').item(0).firstChild.data==0)
	{
		showMe('vcommentsfailure');
		showMe('addcommentdiv');
	}
	else
	{
		showMe('vcommentssuccess');
	}
}
// Video Comment End

// Report Video Begin
function fxReportVideo(hidethisdiv,vreportremarks,vreportreason,userid,videoid)
{
	videoreportremarks=document.getElementById(vreportremarks).value;
	videoreportreason=document.getElementById(vreportreason).value;
	if(videoreportreason=='')
	{
		showMe('vreportreasonError');
	}
	else
	{
		hideMe(hidethisdiv);
		hideMe('vreportreasonError');
		cp.call(baseurl+'/ajax/myajaxphp.php','video_report',video_report_response,videoreportremarks,videoreportreason,userid,videoid);
	}	
}

function video_report_response(vreportresult)
{
	if(vreportresult.getElementsByTagName('vrepmsg').item(0).firstChild.data==0)
	{
		showMe('vreportfailure');
		showMe('reportvideodiv');
	}
	else
	{
		showMe('vreportsuccess');
	}
}
// Report Video End

// Share Video Begin
function fxShareVideo(hidethisdiv,vsharemessage,vshareto,userid,videoid)
{
	videosharemessage=document.getElementById(vsharemessage).value;
	videoshareto=document.getElementById(vshareto).value;
	if(videoshareto=='')
	{
		showMe('vshareemptyError');
	}
	else
	{
		hideMe(hidethisdiv);
		hideMe('vshareemptyError');
		cp.call(baseurl+'/ajax/myajaxphp.php','video_share',video_share_response,videosharemessage,videoshareto,userid,videoid);
	}	
}

function video_share_response(vshareresult)
{
	if(vshareresult.getElementsByTagName('vshrmsg').item(0).firstChild.data==0)
	{
		showMe('vsharefailure');
		showMe('sharevideodiv');
	}
	else if(vshareresult.getElementsByTagName('vshrmsg').item(0).firstChild.data==2)
	{
		showMe('vsharehalffailure');
		showMe('sharevideodiv');
	}
	else
	{
		showMe('vsharesuccess');
	}
}
// Share Video End

// Favorite Video Begin
function fxFavVideo(hidethisdiv,fuserid,fvideoid)
{
	hideMe(hidethisdiv);	
	cp.call(baseurl+'/ajax/myajaxphp.php','fav_video',fav_video_response,fuserid,fvideoid);		
}

function fav_video_response(favvidresult)
{
	var favvidresp=favvidresult.getElementsByTagName('favvidmessage').item(0).firstChild.data;
	if(favvidresp=='0')
	{
		showMe('addtofavFailure');
	}
	else
	{
		showMe('addtofavSuccess');
	}
}
// Favorite Video End

function showhidelists(a,b){
	showMe(a);
	hideMe(b);	
}