var url = document.URL;
var va = url.split("main");
var spath = '';
if(va[1]==undefined)
{
	var spath = va[0];
}else{
if(va[1].indexOf("admin")!=-1)
{
	va = va[0].split("admin");
	spath = va[0];
}
else
	var spath = va[0];
}
if(spath.indexOf("album")!=-1)
{
	va = va[0].split("album");
	spath = va[0];

 }

if(va[1]==undefined)
{
	var spath2 = va[0];
}else
{
	if((va[1].indexOf("popupplaylist")!=-1) || (va[1].indexOf("detail")!=-1) && (va[1].indexOf("allalbum")))
	{
		if(va[1].indexOf("artistdetail")){
			var spath2 = va[0];
		}else{
		va = va[0].split("popupplaylist");
		spath2 = "Popplist";
		}
	}
	else
	{
		url = document.URL;
		if(url.indexOf("gethitmusic.com/album")!=-1)
		{
		 url = url.split("gethitmusic.com/album");
		 var spath2 = "Popplist";
		}else
		{
			var spath2 = va[0];
		}
	}


}


function showLoading()
{
	document.getElementById("div_loading").style.display = 'block';
	document.getElementById("div_loading").innerHTML = "<img src="+spath+"images/ajax-animation.gif>";
}
function hideLoading(){
	document.getElementById("div_loading").style.display = 'none';
	document.getElementById("div_loading").innerHTML = '';
}
function mainCallback(responseText,divid)
{

  	document.getElementById(divid).innerHTML  = responseText;

	// sandeep();





	if(document.getElementById("YMusicRegion_T3_R2C1_R2")){
		carouselLoad();
	}
	if((document.URL.indexOf("admin_artistvideo")!=-1) && divid == 'viewajaxpart' && responseText!=''){
  	setTimeout("draggable2()", 1000);
	}
}
function mainCallbacktotalRecords(responseText,divid)
{
 	if(responseText.indexOf("TotalChannel")!=-1)
	{	var Total = responseText.split("TotalChannel");

  		document.getElementById(divid).innerHTML  = Total[1];
	}


	if(document.getElementById("YMusicRegion_T3_R2C1_R2")){
		carouselLoad();
	}
}
function mainCallback_forplayer(responseText,divid)
{
	document.getElementById(divid).innerHTML  = responseText;
	//var script = 'http://192.168.0.181/gethitmusic/js/addthis.js#domready=1';
	var script = spath+'js/addthis.js#username=kipltest';
		if (window.addthis){
			window.addthis = null;
		}
		$.getScript( script );

}
function mainCallback_schedular(responseText,divid)
{
  	 if(responseText.indexOf("Exists")!=-1)
	 {
		var brandid = responseText.split("Exists");
 		 var conf= window.confirm("Do You want to create Sub - Channel");
		 if(conf)
		 {
			 document.selectorganization.submit();
			// window.location.href = "main.php?do=adminalbum&action=channel&type=channel&createsub_channel=subchannel&organizationid="+brandid[1];
		 }
	 }
	 if(responseText.indexOf("NoSubChannel")!=-1)
	 {

		window.location.href = "main.php?do=adminalbum&action=channel&type=channel";

	 }
}

function mainCallbackSchedulerPaging(responseText,divid)
{
  	document.getElementById(divid).innerHTML  = responseText;
	setTimeout("draggable()", 1000);
}
function mainCallback_schedular_preview(responseText,divid)
{
   	  document.getElementById(divid).innerHTML=responseText ;
}
function popup_box(title, body, wid, hei){
	width = (wid) ? wid : 500;
	height = (hei) ? hei : 500;

	box = '<TABLE CELLSPACING="0" CELLPADDING="0" BORDER="0" ><tr><td align="center" valign="top"><TABLE cellspacing="0" cellpadding="0" border="0" width="100%" onmousedown="dragWindow(event, '+'\'form_div\''+');"><TR ><td WIDTH="8"><IMG SRC="images/leftss.jpg" WIDTH="8" HEIGHT="20" BORDER="0" ALT=""></td><td align="left" background="images/sliderss.jpg" width="100%" HEIGHT="20" BORDER="0" ALT=""  Class="white"><B>'+title+'</B></td><TD background="images/sliderss.jpg" width="100%" HEIGHT="20" BORDER="0" ALT="" align="right"><A HREF="javascript:closeForm();void(0);" id="close_img"><IMG SRC="images/cross_ji.jpg" WIDTH="15" HEIGHT="15" BORDER="0" ALT="" ></A></TD><td WIDTH="8"><IMG SRC="images/rightss.jpg" WIDTH="8" HEIGHT="20" BORDER="0" ALT=""></td></TR></TABLE></td></tr><tr><td colspan="3"  class="White" style="border:1px solid #000000"><TABLE CELLSPACING="0" CELLPADDING="0" BORDER="0" bgcolor="#OOOOOO" width="100%"><TR><TD align="center"><TABLE cellspacing=0 cellpadding=0 border=0 align="center" ><TR><TD><div style="width:'+width+';height:'+height+';scrollbar-base-color:#373F4D;scrollbar-track-color:#78797D; scrollbar-arrow-color:#FFFFFF;padding:5px 5px 5px 5px" id="popupBody">'+body+'</div></TD></TR></TABLE>';
	return box;
}

function popup_boxnew(title, body, wid, hei){
	width = (wid) ? wid : 500;
	height = (hei) ? hei : 500;

	box = '<TABLE CELLSPACING="0" CELLPADDING="0" BORDER="0" ><tr><td align="center" valign="top"><TABLE cellspacing="0" cellpadding="0" border="0" width="100%" onmousedown="dragWindow(event, '+'\'form_divnew\''+');"><TR ><td WIDTH="8"><IMG SRC="images/leftss.jpg" WIDTH="8" HEIGHT="20" BORDER="0" ALT=""></td><td align="left" background="images/sliderss.jpg" width="100%" HEIGHT="20" BORDER="0" ALT=""  Class="white"><B>'+title+'</B></td><TD background="images/sliderss.jpg" width="100%" HEIGHT="20" BORDER="0" ALT="" align="right"><A HREF="javascript:closeForm();void(0);" id="close_img"><IMG SRC="images/cross_ji.jpg" WIDTH="15" HEIGHT="15" BORDER="0" ALT="" ></A></TD><td WIDTH="8"><IMG SRC="images/rightss.jpg" WIDTH="8" HEIGHT="20" BORDER="0" ALT=""></td></TR></TABLE></td></tr><tr><td colspan="3"  class="White" style="border:1px solid #000000"><TABLE CELLSPACING="0" CELLPADDING="0" BORDER="0" bgcolor="#OOOOOO" width="100%"><TR><TD align="center"><TABLE cellspacing=0 cellpadding=0 border=0 align="center" ><TR><TD><div style="width:'+width+';height:'+height+';scrollbar-base-color:#373F4D;scrollbar-track-color:#78797D; scrollbar-arrow-color:#FFFFFF;padding:5px 5px 5px 5px" id="popupBody">'+body+'</div></TD></TR></TABLE>';
	return box;
}

var popTitle;
function setPopTitle(title){
	popTitle = title;
}

function getPopTitle(){
	return popTitle;
}

var popWidth;
function setpopWidth(width){
	popWidth = width;
}

function getpopWidth(){
	return popWidth;
}

var popHeight;
function setpopHeight(height){
	popHeight = height;
}

function getpopHeight(){
	return popHeight;
}
var folderName;
function setfolderName(folder){
	folderName = folder;
}

function getfolderName(){
	return folderName;
}
function LTrim( value ) {
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
}

// Removes ending whitespaces
function RTrim( value ) {
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
}

// Removes leading and ending whitespaces
function trim(value) {
	return LTrim(RTrim(value));
}

function user_backtohome(){
	url = "main.php?do=homepage&action=home";
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("user_backtohome();");
}

function signup() {
	url = "main.php?do=signin&action=viewnew";
	//alert(url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("signup();");
}

function selectcont(){
	//alert('xfd');
	countryname = document.getElementById("countid").value;
	//alert(countryname);
	if(countryname == 'UNITED STATES'){
		document.getElementById("statdiv").style.display = 'block';
	}else{
		document.getElementById("statdiv").style.display = 'none';
	}

}

function fansignup() {
	url = "main.php?do=signin&action=nextptotype";
	//alert(url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("fansignup();");
}

function artist_login(){
	url = "main.php?do=signin&action=clone1";
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("artist_login();");
	user_backtohome();
}

function artist_item() {
	url = "main.php?do=signin&action=view";
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("artist_item();");
}

function artist_photo() {
	url = "main.php?do=artistimages&action=insert";
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("artist_photo();");
}

function show_bottum_pageold(id){
	//alert(id);
	url = "main.php?do=bottumpage&action=view&id="+id;
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("show_bottum_pageold('"+id+"');");
}

function show_bottum_page(id){
	setPopTitle('');
	setpopWidth(700);
	setpopHeight(500);
	url = "main.php?do=bottumpage&action=view&id="+id;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, showuploadpopupnew, "GET");
}

function del_image(myid){
	var msg="Do you want to delete!";
	if(confirm(msg))
		{
			delete_record=true;
		}
		else
		{
			delete_record=false;
		}
	if (delete_record)
	{
		//main.php?do=artistimages&method=delete&id
		url = "main.php?do=artistimages&action=delete&id=" + myid;
		var ajax = new GHM.AJAX();
		ajax.callPage(url, mainCallback, "GET");
	}
}

function upload_artistimage(img,id,title){
	//addimage.php?img=<?=$image_path?>&title=<?=$artist_name?>&id=<?=$user_id?>
	url = "addimageIframa.php?img="+img+"&id="+id+"&title="+title;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, showuploadpopup, "GET");
}

function edit_file(){

	//if (!CheckInput("artistpersonalimage.images_upload","images_upload")) return false;
	if (!CheckInput("add_personalinfo.file_name","image")) return false;

	//formString = setForm ("addvideo");

	if (!document.getElementById("IframeId"))
	{
		createFrame();
	}

	var doc = document.add_personalinfo;

 	doc.target = "IframeId";
	doc.submit();

 	//document.getElementById("per_imag").innerHTML  = 'Updation had made successfully...!Click back to return &nbsp;<INPUT TYPE="button" class = "Button" NAME="back" value="Back" onclick ="javascript: upload_per_imag();">';

	//url = "main.php?do=artistimages&action=create&img="+img;
	//alert(url);
	//var ajax = new GHM.AJAX();
	//ajax.callPage(url, mainCallback, "GET");
}

function upload_per_imag(){
	//addimage.php?img=<?=$image_path?>&title=<?=$artist_name?>&id=<?=$user_id?>
	url = "main.php?do=artistimages&action=create";
	var ajax = new GHM.AJAX();
	ajax.callPage(url, showuploadpopup, "GET");
}

function setThumb(){
    document.getElementById("thumb").src = document.add_personalinfo.file_name.value;
}


function showuploadpopup(msg){
	document.getElementById("alertmask").style.display = 'block';
	newPopupBox = popup_box(getPopTitle(), msg, getpopWidth(), getpopHeight());

	document.getElementById("form_div").style.display = 'block';
	document.getElementById("form_div").innerHTML = newPopupBox;
}

function showuploadpopupnew(msg){
	//alert(msg);
	document.getElementById("alertmask").style.display = 'block';
	newPopupBox = popup_boxnew(getPopTitle(), msg, getpopWidth(), getpopHeight());

	document.getElementById("form_divnew").style.display = 'block';
	document.getElementById("form_divnew").innerHTML = newPopupBox;
}
function checkuploadimage() {
	url = "main.php?do=artistimages&action=create";
	var ajax = new GHM.AJAX();
	ajax.callPage(url, showuploadpopup, "GET");
	/*
	if (!CheckInput("imageform.file_name","file_name")) return false;

	if (!document.getElementById("IframeId"))
	{
		createFrame();
	}
	var doc = document.imageform;
	doc.target = "IframeId";
	//alert(doc);
	doc.submit();
	document.getElementById("uploaded").innerHTML = 'your image is uploaded';*/

}


function closepopup(){
	closeForm();
	//window.close();
	artist_photo();
}


function artist_video(){
	url = "main.php?do=artistvideo&action=view";
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("artist_video();");
}

function add_newvideo(){
	url = "main.php?do=artistvideo&action=insert";
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, neweventCallback, "GET");
	addLink("add_newvideo();");
}

function check_addvideoform(){
	if (!CheckInput("addvideo.title","title")) return false;
	if (!CheckInput("addvideo.file_name","Graphics")) return false;
	if (!CheckInput("addvideo.filename","Play file ")) return false;
	if (!CheckInput("addvideo.price","Price")) return false;
	if (!CheckInput("addvideo.description","Description")) return false;

	if(isNaN(document.addvideo.price.value)){
			alert('Price must be in numeric!');
			document.addvideo.price.focus();
		return false;
	}

	//formString = setForm ("addvideo");

	if (!document.getElementById("IframeId"))
	{
		createFrame();
	}

	var doc = document.addvideo;
	doc.target = "IframeId";
	doc.submit();
	document.getElementById("vrmsg_div").innerHTML  = 'Data save successfully...!Click back to return &nbsp;<INPUT TYPE="button" class = "Button" NAME="back" value="Back" onclick ="javascript: artist_video();">';
	//artist_video();
}

function check_editvideoform(){
	if (!CheckInput("addvideo.title","title")) return false;
	//if (!CheckInput("addvideo.file_name","Graphics")) return false;
	if (!CheckInput("addvideo.filename","Play file ")) return false;
	if (!CheckInput("addvideo.price","Price")) return false;
	if (!CheckInput("addvideo.description","Description")) return false;

	if(isNaN(document.addvideo.price.value)){
			alert('Price must be in numeric!');
			document.addvideo.price.focus();
		return false;
	}

	//formString = setForm ("addvideo");

	if (!document.getElementById("IframeId"))
	{
		createFrame();
	}

	var doc = document.addvideo;
	doc.target = "IframeId";
	doc.submit();
	document.getElementById("vrmsg_div").innerHTML  = 'Updation had made successfully...!Click back to return &nbsp;<INPUT TYPE="button" class = "Button" NAME="back" value="Back" onclick ="javascript: artist_video();">';
	//artist_video();

}

function edit_artistvideo(myid){
	url = "main.php?do=artistvideo&action=edit&id=" + myid;
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("edit_artistvideo('"+myid+"');");
}

function delCheck(myid){
	var msg="Do you want to delete!";
	if(confirm(msg))
		{
			delete_record=true;
		}
		else
		{
			delete_record=false;
		}
	if (delete_record)
	{
		url = "main.php?do=artistvideo&action=delete&id=" + myid;
		var ajax = new GHM.AJAX();
		ajax.callPage(url, mainCallback, "GET");
	}

}

function change_videostatus(myid,mystat){
	url = "main.php?do=artistvideo&action=changeptotype&id=" + myid + "&status=" + mystat;
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("change_videostatus('"+myid+"','"+mystat+"');");
}

function open_videopagination(page){
	//url = "main.php?do=event&action=detail&page=" + page;
	url = "main.php?do=artistvideo&action=view&page="+ page;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_videopagination('"+page+"');");
}



function MM_openBrWindow(theURL,winName,features) {
	  window.open(theURL,winName,features);
}



function artist_info() {
	url = "main.php?do=signin&action=display";
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("artist_info();");
}

function edit_artist_info() {
	url = "main.php?do=signin&action=edit";
	//alert(url);
	//formString = setForm("add_personalinfo");
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("edit_artist_info();");
}

function save_artist_info(){
	if(document.add_personalinfo.form_user.value == 'F'){
		alert('Please check username');
		document.add_personalinfo.user_name.focus();
		return false;
	}
	if (!CheckInput("add_personalinfo.user_name","username")) return false;
	if (!badEmail("add_personalinfo.email","Email")) return false;
	if (!CheckInput("add_personalinfo.publicname","name")) return false;
	if (!CheckInput("add_personalinfo.password1","password")) return false;

	if(document.add_personalinfo.password1.value.length < 6){
		alert('Password must be greater then 5 digit !');
		return false;
	}

	formString = setForm ("add_personalinfo");
	//alert(formString);
	url = "main.php?do=signin&action=save&" + formString;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	//addLink("save_artist_info();");
	/*if (!document.getElementById("IframeId"))
	{
		createFrame();
	}
	var doc = document.add_personalinfo;
	doc.target = "IframeId";
	doc.submit(); */

}

function payment_info() {
	url = "main.php?do=signin&action=create";
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("payment_info();");
}

function show_events() {
	url = "main.php?do=event&action=view";
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("show_events();");
}

function show_eventdetails(id) {
	url = "main.php?do=event&action=detailnew&id="+id;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("show_eventdetails('"+id+"');");
}

function open_eventpagination(page){
	url = "main.php?do=event&action=view&page=" + page;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_eventpagination('"+page+"');");
}

function create_newevent(){
	url = "main.php?do=event&action=home";
	var ajax = new GHM.AJAX();
	ajax.callPage(url, neweventCallback, "GET");
	addLink("create_newevent();");
}

function showalertMessage(msg){
	document.getElementById("alertmask").style.display = 'block';
	newPopupBox = popup_box("Alert", msg, 300, 100);
	document.getElementById("form_div").style.display = 'block';
	document.getElementById("form_div").innerHTML = newPopupBox;
}

function neweventCallback(responseText){

	if(responseText.indexOf("LOGIN_REQUIRED") != -1){
		alert("You Must Be Logged-In to access control");
	}else if(responseText.indexOf("ARTIST_REQUIRED") != -1){
		alert("You Must Be Logged-In as an artist to access control");
	}else if(responseText.indexOf("OPEN_PAGE") != -1){
		url = responseText.replace("OPEN_PAGE=", "");
		location.href=url;
	}else if(responseText.indexOf("OPEN_FORUM") != -1){
		url = responseText.replace("OPEN_FORUM=", "");
		location.href=url;
	}else {
		document.getElementById("main_div").innerHTML  = responseText;
	}
}

function check_neweventform(){

	if (!CheckInput("addevent.name","Name")) return false;
	if (!CheckInput("addevent.country","Country")) return false;
	if (!CheckInput("addevent.date1","Date")) return false;
	if (!CheckInput("addevent.file_name","File name")) return false;
	if (!CheckInput("addevent.description","Description")) return false;
	if (!CheckInput("addevent.time","Time")) return false;
	if (!CheckInput("addevent.state","State")) return false;

	if (!document.getElementById("IframeId"))
	{
		createFrame();
	}
	var doc = document.addevent;
	doc.target = "IframeId";
	doc.submit();
	document.getElementById("ademsg").innerHTML  = 'record saved successfully...!Click back to return &nbsp;<INPUT TYPE="button" class = "Button" NAME="back" value="Back" onclick ="javascript: open_eventsposted();">';

}

function save_newevent(responseText){
    //url = "main.php?do=event&action=save";
	//alert(url);
	//var ajax = new GHM.AJAX();
	//ajax.callPage(url, mainCallback, "GET");
	document.getElementById("main_div").innerHTML  = responseText;
}

function open_eventsposted(){
	url = "main.php?do=event&action=detail";
	var ajax = new GHM.AJAX();
	ajax.callPage(url, neweventCallback, "GET");
	addLink("open_eventsposted();");
}



function show_pastevents(){
	url = "main.php?do=event&action=display";
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("show_pastevents();");
}

function open_eventspagination(page){
	url = "main.php?do=event&action=detail&page=" + page;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_eventspagination('"+page+"');");
}

function create_einvitation(){
	url = "main.php?do=event&action=login";
	var ajax = new GHM.AJAX();
	ajax.callPage(url, neweventCallback, "GET");
	addLink("create_einvitation();");
}

function check_sendeinvitationform(){
	if (!badEmail("eventinvitation.email","Email")) return false;
	if (!CheckInput("eventinvitation.subject","Subject")) return false;
	if (!CheckInput("eventinvitation.invitefor","Invite for")) return false;
	formString = setForm ("eventinvitation");
	url = "main.php?do=event&action=send&" + formString;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	//addLink("check_sendeinvitationform();");
}

function open_blogs(check){
	//url = "main.php?do=event&action=detail&page=" + page;
	url = "main.php?do=blogs&action=preview&check=" + check;

	var ajax = new GHM.AJAX();
	ajax.callPage(url, neweventCallback, "GET");
	addLink("open_blogs('"+check+"');");
}

function open_blogsdetails(id){
	//url = "main.php?do=event&action=detail&page=" + page;

	url = "main.php?do=blogs&action=detailnew&blogid="+id;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_blogsdetails('"+id+"');");
}

function open_blogsbycat(catid){
	//url = "main.php?do=blogs&action=viewnew&blog_cat_id=" + catid;
	url = "main.php?do=blogs&action=preview&blog_cat_id=" + catid;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_blogsbycat('"+catid+"');");
}

function open_myblogsbycat(catid,check){
	//url = "main.php?do=blogs&action=viewnew&blog_cat_id=" + catid;
	url = "main.php?do=blogs&action=preview&blog_cat_id=" + catid+"&check="+check;
	//alert(url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_myblogsbycat('"+catid+"','"+check+"');");
}

function open_myblogsbyfeature(catid,type){
	//url = "main.php?do=blogs&action=viewnew&blog_cat_id=" + catid;
	url = "main.php?do=blogs&action=preview&blog_cat_id=" + catid+"&type="+type;
	//alert(url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_myblogsbyfeature('"+catid+"','"+type+"');");
}


function open_blogspagination(page){
	url = "main.php?do=blogs&action=preview&page=" + page;
	//url = "main.php?do=blogs&action=preview&page=" + page;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_blogspagination('"+page+"');");
}


function open_featureblogs(){
	var j = 'feature';
	url = "main.php?do=blogs&action=preview&type="+j;
	//alert(url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_featureblogs();");
}

function create_newblogs(){
	url = "main.php?do=newblogs&action=insert";
	var ajax = new GHM.AJAX();
	ajax.callPage(url, neweventCallback, "GET");
	addLink("create_newblogs();");
}

function edit_blogs(myid,type){
	url = "main.php?do=newblogs&action=edit&id=" + myid + "&type"+type;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("edit_blogs('"+myid+"','"+type+"');");
}

function del_blogs(id,img){
	var msg="Do you want to delete!";
	if(confirm(msg))
		{
			delete_record=true;
		}
		else
		{
			delete_record=false;
		}
	if (delete_record)
	{
		url = "main.php?do=blogs&action=delete&id=" + id + "&image" +img;
		//alert(url);
		var ajax = new GHM.AJAX();
		ajax.callPage(url, mainCallback, "GET");

	}
}

function check_saveblogform(){

	if (!CheckInput("addblog.name","Name")) return false;
	if (!CheckInput("addblog.description","description")) return false;
	if (!CheckInput("addblog.category","category")) return false;

	/*formString = setForm ("addevent");
	url = "main.php?do=event&action=save&" + formString;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, save_newevent, "GET");*/

	if (!document.getElementById("IframeId"))
	{
		createFrame();
	}
	var doc = document.addblog;
	var check = 'your_blog';
	doc.target = "IframeId";
	doc.submit();
	document.getElementById("adblogmsg_div").innerHTML  = 'record saved successfully...!Click back to return &nbsp;<INPUT TYPE="button" class = "Button" NAME="back" value="Back" onclick ="javascript: open_blogs();">';

}

function check_updateblogform(){
	if (!CheckInput("addblog.name","blog title")) return false;
	if (!CheckInput("addblog.description","description")) return false;
	if (!CheckInput("addblog.category","category")) return false;

	if (!document.getElementById("IframeId"))
	{
		createFrame();
	}
	var doc = document.addblog;
	var check = 'your_blog';
	doc.target = "IframeId";
	doc.submit();
	document.getElementById("adblogmsg_div").innerHTML  = 'record update successfully...!Click back to return &nbsp;<INPUT TYPE="button" class = "Button" NAME="back" value="Back" onclick ="javascript: open_blogs();">';
}

function open_blogcomments(id){
	url = "main.php?do=blogs&action=summary&blogid="+id;
	//alert(url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_blogcomments('"+id+"');");
}

function open_newblogcomments(id){
	url = "main.php?do=blogs&action=insert_actions&blogid="+id;
	//alert(url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_newblogcomments('"+id+"');");
}

function check_saveblogcommentsform(){

	 if(document.getElementById("title").value=='')
	 {
		 alert("Comment By is Empty");
		 return false;
	 }
	 if(document.getElementById("email1").value=='')
	 {
		 alert("Email is Empty");
		 return false;
	 }
	 if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById("email1").value)))
	{
		alert("Please enter valid email.");

		return false;
	}
	 if(document.getElementById("description1").value=='')
	 {
		 alert("Comment is Empty");
		 return false;
	 }

var	 commentby = document.getElementById("title").value;
var	 emailid = document.getElementById("email1").value;
var	 description1 = document.getElementById("description1").value;
var	 blogid = document.getElementById("id").value;

	//if(document.getElementById("title").value=='')
//	{
//			alert("Comment By is Empty");
//			return false;
//	}
	//if (!CheckInput("add_comment.title","Comments By")) return false;
//	if (!CheckInput("add_comment.email","Email")) return false;
//	if (!CheckInput("add_comment.description1","Comments")) return false;
//	if (!badEmail("add_comment.email","Email")) return false;

	//formString = setForm ("add_comment");
 	var comment = addslashes(description1)

var	frmstring = "&commentby="+commentby+"&emailid="+emailid+"&description1="+comment+"&blogid="+blogid;

	url = "main.php?do=blogs&action=create"+frmstring;

	var ajax = new GHM.AJAX();
	pagination(url,'showcomment');
	document.getElementById("facebox").style.display='none';
     document.getElementById("facebox_overlay").style.display='none';




	//alert(formString);
	//ajax.callPage(url, mainCallback, "GET");

	/*
	if (!document.getElementById("IframeId"))
	{
		createFrame();
	}
	var doc = document.newblogcomments;
	doc.submit();
	//var check = 'your_blog';
	//doc.target = "IframeId";
	//document.getElementById("adblogmsg_div").innerHTML  = 'record saved successfully...!Click back to return &nbsp;<INPUT TYPE="button" class = "Button" NAME="back" value="Back" onclick ="javascript: open_blogs();">';
	*/
}
function update_newchannel()
{

 	var selectedorganization = document.getElementById("orlist").value;
	var channelimage = document.getElementById("channelimage").value;
	var totalrecord = document.getElementById("gettotalchannel").value;

//	stratdate = document.getElementById("date1").value;
//	enddate = document.getElementById("date").value;
//	starttime = document.getElementById("time1").value;
//	endtime = document.getElementById("time").value;
	if(selectedorganization=='')
	{
		alert("Please select one organization for this channel");
		return false;
	}
	if(channelimage=='')
	{
		alert("Please select channel image");
		return false;
	}
	if(channelimage != '' && channelimage.indexOf(".jpg") == -1 && channelimage.indexOf(".gif") == -1 && channelimage.indexOf(".png") == -1){
			alert("Select only jpg,png, gif image");
 			return false;
		}
		if(totalrecord>0)
		{

			 var conf= window.confirm("Do You want to create Sub - Channel");
			 if(conf)
			 {
				 var brandid = document.getElementById("orlist").value;
				document.selectorganization.method = "post";
				document.selectorganization.action = "main.php?do=adminalbum&action=channel&type=channel&createsub_channel=subchannel&organizationid="+brandid;
			//	alert(document.selectorganization.action)
 				document.selectorganization.submit();
				// window.location.href = "main.php?do=adminalbum&action=channel&type=channel&createsub_channel=subchannel&organizationid="+brandid[1];
			 }
		}
		else
		{
				document.selectorganization.method = "post";
				document.selectorganization.action = "main.php?do=adminalbum&action=createchannellist";
				//window.location.href =
				document.selectorganization.submit();
		}

	//+"&startdate="+stratdate+"&enddate="+enddate+"&starttime="+starttime+"&endtime="+endtime;
	//url = "main.php?do=adminalbum&action=createchannellist&organizationid="+selectedorganization+"&channeliamge="+channelimage;
	//alert(url)
	//location.href = url;
	//pagination_schedular(url,'showaj');


	//window.location.href=url;
}
function gettotalchannel(id)
{
	url = "main.php?do=adminalbum&action=checkdulicatchannel&organizationid="+id;
	pagination_totalRecords(url,'totchal');
}
function addslashes(str)
{
	str=str.replace(/\\/g,'\\\\');
	str=str.replace(/\'/g,'\\\'');
	str=str.replace(/\"/g,'\\"');
	str=str.replace(/\0/g,'\\0');
	return str;
}
function open_commentsnew(){
	setpopWidth(200);
	setpopHeight(100);
	setPopTitle('Alert');
	url = "main.php?do=comments&action=comment";
	//alert(url);
	var ajax = new GHM.AJAX();
	//ajax.callPage(url, mainCallback, "GET");
	ajax.callPage(url, showuploadpopup, "GET");

}
function open_youritemnew(){
	setpopWidth(200);
	setpopHeight(100);
	setPopTitle('Alert');
	url = "main.php?do=youritem&action=comment";
	//alert(url);
	var ajax = new GHM.AJAX();
	//ajax.callPage(url, mainCallback, "GET");
	ajax.callPage(url, showuploadpopup, "GET");

}

function open_accountingnew(){
	setpopWidth(200);
	setpopHeight(100);
	setPopTitle('Alert');
	url = "main.php?do=accounting&action=comment";
	//alert(url);
	var ajax = new GHM.AJAX();
	//ajax.callPage(url, mainCallback, "GET");
	ajax.callPage(url, showuploadpopup, "GET");

}

function open_comments(){
	url = "main.php?do=comments&action=view"
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_comments();");
}




function create_comments(){
	url = "main.php?do=comments&action=insert";
	var ajax = new GHM.AJAX();
	ajax.callPage(url, neweventCallback, "GET");
	addLink("create_comments();");
}

function edit_comments(myid){
	url = "main.php?do=comments&action=edit&id=" + myid ;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("edit_comments('"+myid+"');");
}

function save_commentsform(){

	if (!CheckInput("addcomments.description","description")) return false;

	if (!document.getElementById("IframeId"))
	{
		createFrame();
	}
	var doc = document.addcomments;
	doc.target = "IframeId";
	doc.submit();
	document.getElementById("adcomments_div").innerHTML  = 'record saved successfully...!Click back to return &nbsp;<INPUT TYPE="button" class = "Button" NAME="back" value="Back" onclick ="javascript: open_comments();">';
}

function update_commentsform(){
	if (!CheckInput("addcomments.description","description")) return false;

	if (!document.getElementById("IframeId"))
	{
		createFrame();
	}
	var doc = document.addcomments;
	doc.target = "IframeId";
	doc.submit();
	document.getElementById("adcomments_div").innerHTML  = 'record update successfully...!Click back to return &nbsp;<INPUT TYPE="button" class = "Button" NAME="back" value="Back" onclick ="javascript: open_comments();">';
}

function delete_comments(id){
	var msg="Do you want to delete!";
	if(confirm(msg))
		{
			delete_record=true;
		}
		else
		{
			delete_record=false;
		}
	if (delete_record)
	{
		url = "main.php?do=comments&action=delete&id=" + id ;
		//alert(url);
		var ajax = new GHM.AJAX();
		ajax.callPage(url, mainCallback, "GET");

	}
}

function open_commentspagination(page){
	//url = "main.php?do=event&action=detail&page=" + page;
	url = "main.php?do=comments&action=view&page=" + page;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_commentspagination('"+page+"');");
}

function open_calender(){
	url = "main.php?do=calender&action=view";
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_calender();");
}
function open_nextmonth(m){
	//alert(m);
	nm = m +1;
	url = "main.php?do=calender&action=view&month="+nm;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_nextmonth('"+m+"');");
}

function open_prvmonth(m){
	//alert(m);
	nm = m -1;
	url = "main.php?do=calender&action=view&month="+nm;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_prvmonth('"+m+"');");
}

function open_addressbook(){
	url = "main.php?do=addbook&action=view";
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_addressbook();");
}

function open_addressbookpagination(page){
	url = "main.php?do=addbook&action=view&page=" +page;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_addressbookpagination('"+page+"');");
}

function open_youritem(){
	url = "main.php?do=youritem&action=view";
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_youritem();");
}

function open_accounting(aid){
	//alert(aid);
	url = "main.php?do=accounting&action=view&artistid="+aid;
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_accounting('"+aid+"');");
}


function open_youritempagination(page){
	url = "main.php?do=youritem&action=view&page=" +page;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_youritempagination('"+page+"');");
}

function open_youritempagination1(page1){
	url = "main.php?do=youritem&action=view&page1=" +page1;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_youritempagination1('"+page1+"');");
}



function add_newcontact(){
	url = "main.php?do=addbook&action=insert";
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("add_newcontact();");
}

function check_addaddressbookform(){
	if (!CheckInput("addnewbook.user_name","username")) return false;
	formString = setForm ("addnewbook");
	url = "main.php?do=addbook&action=save&" + formString;
	//alert(url);
	var ajax = new GHM.AJAX();
	//ajax.callPage(url, mainCallback, "GET");
	ajax.callPage(url, addaddressCallback, "GET");
}

function addaddressCallback(responseText){
	//alert(responseText);
	document.getElementById("notexist_div").innerHTML = "";
	if (responseText.indexOf("NOTEXIST") != -1)
	{
		document.getElementById("notexist_div").innerHTML  = "There is no any user of this name!";
	}else{
		document.getElementById("main_div").innerHTML  = responseText;
	}
}


function check_saveaddbookform(){
	if (!CheckInput("lookupform.user_name","user name")) return false;
	formString = setForm ("lookupform");
	url = "main.php?do=addbook&action=update&" + formString;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, addbookCallback, "GET");

	/*
	if (!document.getElementById("IframeId"))
	{
		createFrame();
	}
	var doc = document.lookupform;
	doc.target = "IframeId";
	doc.submit();
	document.getElementById("admsg_div").innerHTML  = 'record saved successfully...!Click back to return &nbsp;<INPUT TYPE="button" class = "Button" NAME="back" value="Back" onclick ="javascript: open_addressbook();">';
	*/
}

function addbookCallback(responseText){
	//alert(responseText);
	document.getElementById("duplicate_msg").innerHTML = "";
	if (responseText.indexOf("ADDBOOKMSG") != -1)
	{
		document.getElementById("duplicate_msg").innerHTML  = "This user is already in your Address Book!";
	}else{
		document.getElementById("main_div").innerHTML  = responseText;
	}
}

function del_addbook(myid){
	var msg="Do you want to delete!";
	if(confirm(msg))
		{
			delete_record=true;
		}
		else
		{
			delete_record=false;
		}
	if (delete_record)
	{
		url = "main.php?do=addbook&action=delete&id=" + myid;
		var ajax = new GHM.AJAX();
		ajax.callPage(url, mainCallback, "GET");
	}

}

function open_dircetory(){
	url = "main.php?do=shows&action=detail";
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_dircetory();");
}

function open_directorypagination(page){
	url = "main.php?do=shows&action=detail&page=" + page;
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_directorypagination('"+page+"');");
}
function open_alphapage(page,alpha){
	url = "main.php?do=shows&action=detail&page=" + page+ "&alpha=" + alpha;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_alphapage('"+page+"','"+alpha+"');");
}
function open_dirgensearch(genre){
	url = "main.php?do=shows&action=detail&genre=" +genre;
	//alert(genre);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_dirgensearch('"+genre+"');");
}

function open_artistspage(id){
	url = "main.php?do=shows&action=home&id=" +id;
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_artistspage('"+id+"');");
}

function open_newinvite(){
	url = "main.php?do=invite&action=view";
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, neweventCallback, "GET");
	addLink("open_newinvite();");
}

function check_newinvitation() {
	var totalemail = document.getElementById("totalemail").value;
	var totalblank=0;
	for(i=1;i<=totalemail;i++)
	{
		if(document.getElementById("email"+i).value=='')
		{
			var totalblank=totalblank+1
		}
		if(document.getElementById("email"+i).value!='')
		{
			if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById("email"+i).value)))
			{
				alert("Please enter valid email.");
				document.getElementById("email"+i).focus();
 				return false;
			}
		}
	}
	if(totalblank==totalemail)
	{
		alert("Please fill any one email address");
		return false;
	}


	if (!CheckInput("inviteform.subject","Subject")) return false;
	//if (!CheckInput("inviteform.invitefor","Invite for")) return false;


	//formString = setForm ("inviteform");
	//url = "main.php?do=invite&action=save&" +formString;
	//alert(url);
	//var ajax = new GHM.AJAX();
	//ajax.callPage(url, mainCallback, "GET");
}

function open_invhistory(){
	url = "main.php?do=invite&action=home";
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_invhistory();");
}

function del_invitemail(myid){
	var msg="Do you want to delete!";
	if(confirm(msg))
		{
			delete_record=true;
		}
		else
		{
			delete_record=false;
		}
	if (delete_record)
	{

		url = "main.php?do=invite&action=delete&id=" + myid;
		var ajax = new GHM.AJAX();
		ajax.callPage(url, mainCallback, "GET");
	}
}

function open_invhistpagination(page){
	url = "main.php?do=invite&action=home&page=" + page;
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_invhistpagination('"+page+"');");
}

function open_classified(){
	url = "main.php?do=classified&action=display";
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_classified();");
}


function cat_check() {
	formString = setForm ("catform");
	url = "main.php?do=classified&action=display&" +formString;
	//alert(url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	//addLink("cat_check();");
}

function classified_search(){
	if (!CheckInput("catform.search_name","search_name")) return false;
	formString = setForm ("catform");
	//alert (formString);
	url = "main.php?do=classified&action=browse&" +formString; //return false;
	//alert(url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
}

function open_classifiedbycat(cat,subcat){
	url = "main.php?do=classified&action=browse&cat="+cat+"&subcat="+subcat; //return false;
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_classifiedbycat('"+cat+"','"+subcat+"');");

}


function classifiedsrch_byid(id){
	url = "main.php?do=classified&action=browse&searchid="+id; //return false;
	//alert(url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("classifiedsrch_byid('"+id+"');");
}

function open_conadvrt(searchid,sendmsg){
	formString = setForm ("catform");
	url = "main.php?do=classified&action=browse&searchid=" +searchid+"&sendmsg="+sendmsg;
	//alert(url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	//addLink("open_conadvrt("+id+");");

}

function open_classifieddetail(searchid){
	formString = setForm ("catform");
	url = "main.php?do=classified&action=browse&srcid=" +searchid;
	//alert(url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");

}

function open_addpost(){
	formString = setForm ("catform");
	//url = "main.php?do=classified&action=browse&searchid=" +searchid+"&sendmsg="+sendmsg;
	url = "main.php?do=classified&action=home";
	//alert(url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, neweventCallback, "GET");

}

function cat_addpostcheck() {
	formString = setForm ("catform");
	url = "main.php?do=classified&action=home&" +formString;
	//alert(url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
}
function check_savepostadd(){

	if (!CheckInput("catform.cat1","category")) return false;
	if (!CheckInput("catform.subcat","Subcategory")) return false;
	if (!CheckInput("catform.title","Title")) return false;
	if (!CheckInput("catform.short_desc","Short description")) return false;
	if (!CheckInput("catform.url","url")) return false;
	if (!CheckInput("catform.name","Name")) return false;
	if (!badEmail("catform.email","Email")) return false;
	if (!CheckInput("catform.name","Mobile No.")) return false;

	formString = setForm ("catform");
	url = "main.php?do=classified&action=save&" +formString;
	//alert(url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");


}

function open_tour(){
	url = "main.php?do=shows&action=view";
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_tour();");
}

function open_searchmatter(){
	//if (!CheckInput("shsrchform.miles_from","upto miles")) return false;
	//if (!CheckInput("shsrchform.country","country")) return false;

	formString = setForm ("shsrchform");
	//alert (formString);
	url = "main.php?do=shows&action=view&search=&" +formString;

	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
}

function open_showspage(id,showid){
	url = "main.php?do=shows&action=home&id=" +id+"&showsid="+showid;
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_showspage('"+id+"','"+showid+"');");
}

function open_tourpagination(page){
	url = "main.php?do=shows&action=view&page=" + page;
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_tourpagination('"+page+"');");
}

function open_showsdetails(showid){
	url = "main.php?do=shows&action=display&showsid=" +showid;
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_showsdetails('"+showid+"');");
}

function save_joinevent(){
	if (!CheckInput("showdetails.showid","shows content")) return false;
	if (!CheckInput("showdetails.artistid","artist id")) return false;

	formString = setForm ("showdetails");
	url = "main.php?do=shows&action=create&" +formString;
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, savejoineventCallback, "GET");
}

function savejoineventCallback(responseText){

	document.getElementById("jmessage").innerHTML = "";
	if (responseText.indexOf("DUPLICATE") != -1)
	{
		document.getElementById("jmessage").innerHTML  = "You have already added this in your calender!";
	}else if (responseText.indexOf("SUCCESSFULL") != -1)
	{
		document.getElementById("jmessage").innerHTML  = "You have successfully made entry in your calender!";
	}else if (document.getElementById("LOGIN_REQUIRED") != -1){
		showalertMessage("You Must Be Logged-In to access control");
	}else{
		document.getElementById("main_div").innerHTML  = responseText;
	}
}

function open_giftvoucher(){
	url = "main.php?do=giftvoucher&action=view";
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_giftvoucher();");
}

function create_giftvoucher(){
	url = "main.php?do=giftvoucher&action=create";
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, neweventCallback, "GET");
	addLink("create_giftvoucher();");
}

function save_giftvoucher(){
	if (!CheckInput("addgft.name","To")) return false;
	if (!CheckInput("addgft.price","Amount")) return false;

	if(isNaN(document.addgft.price.value)){
		alert('Amount must be in numeric!');
		document.addgft.price.focus();
		return false;
	}

	if(document.addgft.price.value <= 0 ){
		alert('Amount must be greater than 0!');
		document.addgft.price.focus();
		return false;
	}

	if(document.addgft.price.value > 2000 ){
		alert('Amount must be less than 2000!');
		document.addgft.price.focus();
		return false;
	}


	if(document.getElementById("byemail").checked == true)
	{
		if (!badEmail("addgft.email","Email")) return false;
	}

	if(document.getElementById("bypostal").checked == true)
	{
		if (!CheckInput("addgft.fname","First Name")) return false;
		if (!CheckInput("addgft.lname","Last Name")) return false;
		if (!CheckInput("addgft.address","Address")) return false;
		if (!CheckInput("addgft.city","City")) return false;
		if (!CheckInput("addgft.zip","Zip")) return false;
		//if (!CheckInput("addgft.state","State")) return false;
		if (!CheckInput("addgft.phone","Phone")) return false;

		if(isNaN(document.addgft.phone.value)){
			alert('Phone must be in numeric!');
			document.addgft.phone.focus();
		return false;
		}
	}

	formString = setForm ("addgft");
	url = "main.php?do=giftvoucher&action=save&" +formString;
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, neweventCallback, "GET");
}

function open_faq(){
	setPopTitle('');
	setpopWidth(700);
	setpopHeight(500);
	url = "main.php?do=faq&action=view";
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, showuploadpopupnew, "GET");
	addLink("open_faq();");
}

function open_faqdetail(id){
	url = "main.php?do=faq&action=view&id="+id;
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_faqdetail('"+id+"');");
}

function open_div123(id){
	//alert('hgfhhgf');
	div_value = document.getElementById("div_val").value;
	if(div_value){
		document.getElementById("faq_"+div_value).style.display = "none";
	}
	document.getElementById("div_val").value = id;
	document.getElementById("faq_"+id).style.display = "block";
}
function open_chat(){
   //changenew
	url = "main.php?do=forum&action=detailnew";
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, neweventCallback, "GET");
	addLink("open_chat();");
}

function open_allvideo(){
   //changenew
	url = "main.php?do=allvideo&action=view";
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, neweventCallback, "GET");
	addLink("open_allvideo();");
}

function open_myvideo(myvdo){
   //changenew
	url = "main.php?do=allvideo&action=view&myvdo="+myvdo;
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, neweventCallback, "GET");
	addLink("open_myvideo('"+myvdo+"');");
}
function allvideo_pagination(page,divid){
	url = "main.php?do=allvideo&action=viewajax&page=" + page;
	//url = "main.php?do=blogs&action=preview&page=" + page;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET",divid);
	//addLink("allvideo_pagination('"+page+"');");
}

function pagination(url,divid,formID)
{	var ajax = new GHM.AJAX();
	document.getElementById("isAjax").value = 1;
  	ajax.callPage(url, mainCallback, "GET",divid);


}
function draggable2(){

 	$(function(){
	$('.dragbox')
	.each(function(){
		$(this).hover(function(){
			$(this).find('span').addClass('collapse');
		}, function(){
			$(this).find('span').removeClass('collapse');
		})
		.find('span').hover(function(){
			$(this).find('.configure').css('visibility', 'visible');
		}, function(){
			$(this).find('.configure').css('visibility', 'hidden');
		})
		.click(function(){
			$(this).siblings('.dragbox-content').toggle();
		})
		.end()
		.find('.configure').css('visibility', 'hidden');
	});
	$('.column').sortable({
		connectWith: '.column',
		handle: 'span',
		cursor: 'move',
		placeholder: 'placeholder',
		forcePlaceholderSize: true,
		opacity: 0.4,
		stop: function(event, ui){
			$(ui.item).find('span').click();
			var sortorder='';
			$('.column').each(function(){
				var itemorder=$(this).sortable('toArray');
				var columnId=$(this).attr('id');
				sortorder+=columnId+'='+itemorder.toString()+'&';
			});

			jQuery.post("main.php?do=admin_artistvideo&action=view&editorpick=editorpick&"+sortorder);


			//alert('ATESTSortOrder: '+sortorder);
			/*Pass sortorder variable to server using ajax to save state*/
		}
	})
	.disableSelection();
});
}
function pagination_totalRecords(url,divid)
{	var ajax = new GHM.AJAX();
// alert(url)
  	ajax.callPage(url, mainCallbacktotalRecords, "GET",divid);
}
function pagination_scheduler_paging(url,divid)
{	var ajax = new GHM.AJAX();
// alert(url)
  	ajax.callPage(url, mainCallbackSchedulerPaging, "GET",divid);
}
function pagination_forplayer(url,divid)
{	var ajax = new GHM.AJAX();
// alert(url)
  	ajax.callPage(url, mainCallback_forplayer, "GET",divid);
}
function pagination_schedular(url,divid)
{	var ajax = new GHM.AJAX();
//	alert(url)
 	ajax.callPage(url, mainCallback_schedular, "GET",divid);
}

function pagination_schedular_videopreview(url,divid)
{	var ajax = new GHM.AJAX();

 	ajax.callPage(url, mainCallback_schedular_preview, "GET",divid);
}

function editor_pagination(url,divid)
{	var ajax = new GHM.AJAX();
	//document.getElementById("gifshow").className = "MarginLeft5 FloatLeft MarginTop10";
	document.getElementById("gifshow").innerHTML = "<img src='images/18-1.gif' height='9' >";
 	ajax.callPage(url, mainCallback, "GET",divid);
}

function open_forum(){
   //changenew
	url = "main.php?do=forum&action=preview";
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, neweventCallback, "GET");
	addLink("open_forum();");
}

function open_allalbum(){
	//changenew
	url = "main.php?do=allalbum&action=view";
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, neweventCallback, "GET");
	addLink("open_allalbum();");
}

function open_myalbum(myalb){
   //changenew
	url = "main.php?do=allalbum&action=view&myalb="+myalb;
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, neweventCallback, "GET");
	addLink("open_myalbum('"+myalb+"');");
}

function open_albumdetail(id){
   //changenew
	url = "main.php?do=allalbum&action=detail&id="+id;
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, neweventCallback, "GET");
	addLink("open_albumdetail('"+id+"');");
}

function open_videodetail(id){
   //changenew
	url = "main.php?do=artistvideo&action=detail&id="+id;
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, neweventCallback, "GET");
	addLink("open_videodetail('"+id+"');");
}

function add_newalbum(){
	url = "main.php?do=allalbum&action=insert";
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, neweventCallback, "GET");
	addLink("add_newalbum();");
}


function allalbum_pagination(page){
	url = "main.php?do=allalbum&action=view&page=" + page;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("allalbum_pagination('"+page+"');");
}

function check_addalbumform(){
	if (!CheckInput("albumnewform.title","title")) return false;
	if (!CheckInput("albumnewform.genre","genre")) return false;
	if (!CheckInput("albumnewform.file_name","Graphics")) return false;
	if (!CheckInput("albumnewform.price","Price")) return false;
	if (!CheckInput("albumnewform.date1","Release Date")) return false;
	//formString = setForm ("addvideo");

	if(isNaN(document.albumnewform.price.value)){
		alert('Price must be in numeric!');
		document.albumnewform.price.focus();
		return false;
	}

	if (!document.getElementById("IframeId"))
	{
		createFrame();
	}

	var doc = document.albumnewform;
	doc.target = "IframeId";
	doc.submit();
	document.getElementById("albmsg_div").innerHTML  = 'Data save successfully...!Click back to return &nbsp;<INPUT TYPE="button" class = "Button" NAME="back" value="Back" onclick ="javascript: open_allalbum();">';
	//artist_video();
}
function delCheck_album(myid){
	var msg="Do you want to delete!";
	if(confirm(msg))
		{
			delete_record=true;
		}
		else
		{
			delete_record=false;
		}
	if (delete_record)
	{
		url = "main.php?do=allalbum&action=delete&id=" + myid;
		var ajax = new GHM.AJAX();
		ajax.callPage(url, mainCallback, "GET");
	}

}

function edit_artistalbum(myid){
	url = "main.php?do=allalbum&action=edit&id=" + myid;
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("edit_artistalbum('"+myid+"');");
}

function check_editalbumform(){

	if (!CheckInput("albumnewform.title","title")) return false;
	if (!CheckInput("albumnewform.genre","genre")) return false;
	if (!CheckInput("albumnewform.price","Price")) return false;
	if (!CheckInput("albumnewform.date1","Release Date")) return false;

	if(document.albumnewform.file_name.value == '' && document.albumnewform.old_image.value == ''){
		alert('There must be atleast one image');
		document.albumnewform.file_name.focus();
		return false;
	}

	if(isNaN(document.albumnewform.price.value)){
		alert('Price must be in numeric!');
		document.albumnewform.price.focus();
		return false;
	}

	if (!document.getElementById("IframeId"))
	{
		createFrame();
	}

	var doc = document.albumnewform;
	doc.target = "IframeId";
	doc.submit();
	document.getElementById("albmsg_div").innerHTML  = 'Updation had made successfully...!Click back to return &nbsp;<INPUT TYPE="button" class = "Button" NAME="back" value="Back" onclick ="javascript: open_myalbum();">';
}

function open_adds(url){
	window.open(url);
}

function open_cart(){
   //changenew
	url = "main.php?do=cart&action=detail";
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, neweventCallback, "GET");
	addLink("open_cart();");
}
function clear_cart(){
	var msg="Do you want to delete!";
	if(confirm(msg))
		{
			clear_cart=true;
		}
		else
		{
			clear_cart=false;
		}
	if (clear_cart)
	{
		url = "main.php?do=cart&action=viewnew"
		var ajax = new GHM.AJAX();
		ajax.callPage(url, neweventCallback, "GET");
	}

}

function checkout_cart(){
	url = "main.php?do=signin&action=cartpayment"
	//alert(url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, neweventCallback, "GET");
	addLink("checkout_cart();");
}

function checkout_cartafts(){
	//url = "main.php?do=checkout&action=view"
	url = "main.php?do=cart&action=view"
	var ajax = new GHM.AJAX();
	ajax.callPage(url, neweventCallback, "GET");
	addLink("checkout_cartafts();");
}

function addtocart(i){
	i = trim(i);
	formString = setForm(i);
	//alert(formString);
	url = "main.php?do=cart&action=view&" + formString;
	//alert(url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	//addLink("edit_artistalbum("+myid+");");
}

function addshipping(){
	ship = document.getElementById('shippingid').value;
	url = "main.php?do=cart&action=addshipping&shipping=" + ship;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("addshipping();");
}

function vdodetail_addtocart(){
	formString = setForm ("vdodetail");
	//alert(formString);
	url = "main.php?do=cart&action=view&" + formString;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
}

function albumdetail_addtocart(){
	//alert('gfdgdf');
	formString = setForm ("albumdetails");
	alert(formString);
	url = "main.php?do=shows&action=cartview&" + formString;

	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
}

function albumdetail_addtocart1(id){

	//alert('fgfg');
	//alert(id);
	url = "main.php?do=cart&action=cartview&id="+id;
	//url = "main.php?do=cart&action=view1&id="+id;

	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("albumdetail_addtocart1('"+id+"');");
}


function del_cartrow(id){
	var msg="Do you want to delete!";
	if(confirm(msg))
		{
			delcart=true;
		}
		else
		{
			delcart=false;
		}
	if (delcart)
	{
		url = "main.php?do=cart&action=delete&id="+id;
		//pagination('main.php?do=cart&action=cartview&id=$id,'innerajaxpage');
		//alert(url);
		var ajax = new GHM.AJAX();
		ajax.callPage(url, mainCallback, "GET");
	}
}

function update_cartrow(id,qty){
	url = "main.php?do=cart&action=view&id="+id+"&update_quantity="+qty;
	//alert(url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("update_cartrow('"+id+"','"+qty+"');");
}

function save_checkoutinfo(){
	if (!CheckInput("order_status.first_name","name")) return false;
	if (!CheckInput("order_status.phone","phone")) return false;
	if (!CheckInput("order_status.email","email")) return false;
	if (!CheckInput("order_status.address","address")) return false;
	if (!CheckInput("order_status.city","city")) return false;
	if (!CheckInput("order_status.state","state")) return false;
	if (!CheckInput("order_status.country","country")) return false;
	if (!CheckInput("order_status.zip","zip")) return false;
	if (!CheckInput("order_status.cardtype","cardtype")) return false;
	if (!CheckInput("order_status.cardname","cardname")) return false;
	if (!CheckInput("order_status.cardholder","cardholder")) return false;
	if (!CheckInput("order_status.month","month")) return false;
	if (!CheckInput("order_status.year","year")) return false;

	if(isNaN(document.order_status.phone.value)){
		alert('phone must be in numeric!');
		document.order_status.phone.focus();
		return false;
	}

	formString = setForm ("order_status");
	url = "main.php?do=checkout&action=update&" +formString;
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
}

function print_invoice(){

	formString = setForm ("invoiceform");
	url = "main.php?do=checkout&action=preview&" +formString;
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");

	/*if (!document.getElementById("IframeId"))
	{
		createFrame();
	}
	var doc = document.invoiceform;
	doc.target = "IframeId";
	doc.submit(); */
}

function open_genrepage(id,genre,subpage,albumpage,subalbumpage,subvideopage){
	url = "main.php?do=genre&action=view&id="+id+"&genre_name="+genre+"&subpage="+subpage+"&albumpage="+albumpage+"&subalbumpage="+subalbumpage+"&subvideopage="+subvideopage;
	//alert(url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_genrepage('"+id+"','"+genre+"','"+subpage+"','"+albumpage+"','"+subalbumpage+"','"+subvideopage+"');");
}

function open_genresubpage(id,genre_name){
	url = "main.php?do=genre&action=viewnew&id="+id+"&genre_name="+genre_name;
	//alert(url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_genresubpage('"+id+"','"+genre_name+"');");
}

function open_artistdetails(id){
	url = "main.php?do=artistdetail&action=insert&id="+id;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_artistdetails('"+id+"');");
}

function open_artistbio(id,bio){
	url = "main.php?do=artistdetail&action=insert&id="+id+'&bio='+bio;
	//alert(url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_artistbio('"+id+"','"+bio+"');");
}

function open_artistvideo(id,video){
	url = "main.php?do=artistdetail&action=insert&id="+id+'&video='+video;
	//alert(url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_artistvideo('"+id+"','"+video+"');");
}

function open_artistphoto(id,photo){
	url = "main.php?do=artistdetail&action=insert&id="+id+'&photo='+photo;
	//alert(url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_artistphoto('"+id+"','"+photo+"');");
}

function open_artistevntshow(id,show){
	url = "main.php?do=artistdetail&action=insert&id="+id+'&show='+show;
	//alert(url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_artistevntshow('"+id+"','"+show+"');");
}

function open_artistmusic(id,music){
	url = "main.php?do=artistdetail&action=insert&id="+id+'&music='+music;
	//alert(url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_artistmusic('"+id+"','"+music+"');");
}

function open_newartist(){
	//changenew
	url = "main.php?do=artistdetail&action=viewnew";
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_newartist();");
}
function newartist_pagination(page){
	url = "main.php?do=artistdetail&action=viewnew&page=" + page;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("newartist_pagination('"+page+"');");
}

function open_newartist_featured(page){
	//changenew
	url = "main.php?do=artistdetail&action=viewnewfeatured&page="+page;
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_newartist_featured('"+page+"');");
}

function open_topartist(page){
	//changenew
	url = "main.php?do=artistdetail&action=viewtop&page="+page;
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_topartist('"+page+"');");
}

function open_topartistvideo(page){
	//changenew
	url = "main.php?do=artistdetail&action=viewtopvideo&page="+page;
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_topartistvideo('"+page+"');");
}

function open_videopick(page){
	//changenew
	url = "main.php?do=homepage&action=home&page="+page;
	//alert (url);
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");

	addLink("open_videopick('"+page+"');");
}

function search_all(vdo){
	//if (!CheckInput("searchallform.srchcontent","Write atleast one word")) return false;
	formString = setForm ("searchallform");
	//(formString);
	//url = "main.php?do=allalbum&action=home&"+ formString;
	url = "main.php?do=allalbum&action=home&vdo="+vdo+"&"+formString;
	//alert(url);

	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
}


function album_searchpagination(page){
	url = "main.php?do=allalbum&action=home&page=" + page;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("album_searchpagination('"+page+"');");
}

function video_searchpagination(vpage,vdo){
	url = "main.php?do=allalbum&action=home&vpage="+vpage+"&vdo="+vdo;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("video_searchpagination('"+vpage+"','"+vdo+"');");
}


/*function searchCallback(responseText){

	document.getElementById("login_message").innerHTML = "";
	if (responseText.indexOf("LOGIN_EMAIL") != -1)
	{
		document.getElementById("login_message").innerHTML  = "Sorry, email does not exist!";
	}else{
		//document.getElementById("main_div").innerHTML  = responseText;
		//document.getElementById("l_id").style.display = "none";
		document.getElementById("l_id").innerHTML  = responseText;
		//document.getElementById("l_id_2").innerHTML  = responseText;
	}
} */




//=========================================================================================
function show(title, body){
	//alert(title);
	scrOfY = document.body.scrollTop;
	scrOfX = document.body.scrollLeft;


	X_value = event.x + scrOfX;
	Y_value = event.y + scrOfY;

	get_data = "<div style='position:absolute; top:"+Y_value+"px; left:"+X_value+"px; z-index:10;'><TABLE width=130' border=0 cellspacing=0 cellpadding=0><TR><TD width='100%' align='center' STYLE='BORDER:1PX SOLID #FF0000'><TABLE bgcolor='#000000'  width='100%' align='center' border=0><TR><TD width='100%' align='left' ><font color=white face=arial><strong>&nbsp;<IMG SRC='"+body+"' WIDTH='250' HEIGHT='200' BORDER='' ALT="+title+"></strong></font></TD></TR><TR><TD  align='left' width='80%'><small>"+"</small></TD></TR></TABLE></TD></TR></TABLE></div>";
	document.getElementById("show_area").innerHTML = get_data;
}
function hide(){
	document.getElementById("show_area").innerHTML = '';
}





function logout() {
	//url = "main.php?do=signin&action=logout";
	url = "main.php?do=homepage&action=detail";
	var ajax = new GHM.AJAX();
	ajax.callPage(url, logoutCallback, "GET");
	//document.getElementById("email").value = "";
	//document.getElementById("password1").value = "";
	//document.getElementById("l_id").style.display = "block";
	user_backtohome();
}

function logoutCallback(responseText){
	document.getElementById("l_id").innerHTML  = responseText;
	//document.getElementById("l_id_2").innerHTML  = responseText;
}

function checkloginuserid(userid){
	if(userid=='')
	{
		alert("Please login to access this page");
		return false;
	}

}

function checklogin(){

	if (!CheckInput("artist_login.email","Email")) return false;
	if (!badEmail("artist_login.email","Email")) return false;
	if (!CheckInput("artist_login.password1","Password")) return false;
	return true;
	//formString = setForm ("artist_login");
	//url = "main.php?do=signin&action=login&" + formString;
	//var ajax = new GHM.AJAX();
	//ajax.callPage(url, loginCallback, "GET");
}

function loginCallback(responseText){

	document.getElementById("login_message").innerHTML = "";
	if (responseText.indexOf("LOGIN_EMAIL") != -1)
	{
		document.getElementById("login_message").innerHTML  = "Sorry, email/password does not exist!";
	}else{
		//document.getElementById("main_div").innerHTML  = responseText;
		//document.getElementById("l_id").style.display = "none";
		document.getElementById("l_id").innerHTML  = responseText;
		//document.getElementById("l_id_2").innerHTML  = responseText;
	}
}
function CheckfanForm(){


	//if (!CheckInput("register_fan.nick_name","Publice name")) return false;
	if(document.register_fan.form_user.value == 'F'){
			alert('Please check username');
			document.register_fan.username.focus();
			return false;
		}

	if (!CheckInput("register_fan.username","User Name")) return false;
	if (!CheckInput("register_fan.email","email")) return false;
	if (!badEmail("register_fan.email","This is a wrong format of email")) return false;


	if (!CheckInput("register_fan.password1","Password")) return false;
	if(document.register_fan.password1.value.length < 6){
		alert('Password must be greater then 5 digit !');
		return false;
	}
	if(document.register_fan.password1.value != document.register_fan.password2.value){
		alert('Password and confirm password should be same !');
		return false;
	}


	if (!CheckInput("register_fan.first_name","First Name")) return false;
	if (!CheckInput("register_fan.last_name","Last Name")) return false;
	if (!CheckInput("register_fan.gender","Gender")) return false;

	if (!CheckInput("register_fan.country","Country")) return false;
	if (!CheckInput("register_fan.hdyfg","How did you find GetHitMusic.com")) return false;
	//if (!CheckInput("register_fan.fartists","Favorite Artists")) return false;

	if(isNaN(document.register_fan.phone.value)){
		alert('Phone Number must be integer!');
		document.register_fan.phone.focus();
		return false;
	}
  //if (!CheckInput("register_fan.fartists","Favourite  Artist")) return false;

	if (!document.register_fan.terms.checked){
		alert('Please click checkbox of the Terms of Service and Privacy Policy');
		document.register_fan.terms.focus();
		return false;
		}

	//formString = setForm ("register_fan");
//	url = "main.php?do=signin&action=changeptotype&" + formString;
//	var ajax = new GHM.AJAX();
//	ajax.callPage(url, registerationCallback, "GET");
}







function CheckForm(){
 	if(document.artist_register.form_user.value == 'F'){
		alert('Please check username');
		document.artist_register.username.focus();
		return false;
	}
	var val = document.getElementById("username").value;

	if(val.length<5)
	{
		alert("Minimum username length should be 5");
		return false;
	}

	if (!CheckInput("artist_register.username","User Name")) return false;
	if (!CheckInput("artist_register.nick_name","Band Name or Artists name")) return false;
	if (!CheckInput("artist_register.email","Email")) return false;
	if (!badEmail("artist_register.email","Email")) return false;
	//if (!CheckInput("artist_register.user_name","User name")) return false;

	if (!CheckInput("artist_register.password1","Password")) return false;
	if(document.artist_register.password1.value.length < 6){
		alert('Password must be greater then 5 digit !');
		return false;
	}
	var pass = document.artist_register.password1.value;
	if(pass.indexOf("")==-1)
	{
		alert("password contain space");
		return false;
	}
	if(document.artist_register.password1.value != document.artist_register.password2.value){
		alert('Password and confirm password should be same !');
		return false;
	}


	//if (!CheckInput("artist_register.genre1","Genre")) return false;
	if (!CheckInput("artist_register.genre1","Genre")) return false;
	if (!CheckInput("artist_register.website","Website")) return false;
	if (!CheckInput("artist_register.bank_name","The name the bank knows")) return false;

	if (!CheckInput("artist_register.address","Street Address")) return false;
	if (!CheckInput("artist_register.country","Country")) return false;

	if (!CheckInput("artist_register.phone","Phone")) return false;

	if(isNaN(document.artist_register.phone.value)){
		alert('Phone Number must be integer!');
		document.artist_register.phone.focus();
		return false;
	}

	if(!document.artist_register.terms.checked){
		alert('Please click checkbox of the Terms of Service and Privacy Policy');
		document.artist_register.terms.focus();
		return false;
	}
	return true;
	//formString = setForm ("artist_register");
	//url = "main.php?do=signin&action=insert&" + formString;

	//var ajax = new GHM.AJAX();
	//ajax.callPage(url, registerationCallback, "GET");
}

function registerationCallback(responseText){

	document.getElementById("message").innerHTML = "";
	if(responseText.indexOf("EMAIL") != -1){
		document.getElementById("message").innerHTML  = "Sorry, email is already registered!";
	}else if (responseText.indexOf("USERNAME") != -1){
		document.getElementById("message").innerHTML  = "Sorry, User name is already registered!";
	}else{
		document.getElementById("main_div").innerHTML  = responseText;
	}
}
function change_featured(id, featured){
	url = "main.php?do=signin&action=viewnewfeatured&pay_id="+id+"&featured="+featured;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, regfeaturedCallback, "GET");
}
function regfeaturedCallback(responseText){
	//alert(responseText);
	document.getElementById("main_div").innerHTML  = responseText;
}

function ckeck_paymentartist(){
	var doc			= document.pay_status;
	if (!CheckInput("pay_status.cardtype","CART TYPE")) return false;
	if (!CheckInput("pay_status.cardname","CARD NO")) return false;
	if (!CheckInput("pay_status.cardholder","CARD HOLDER NAME")) return false;
		month		= doc.month.value;
		year		= doc.year.value;
	if(document.getElementById("date1").value=='')
	{
		alert("Please select Card Expiry Date");
		return false;
	}

		//if(month == ''){
//			alert('please select month');
//			doc.month.focus();
//			return false;
//		}
//		if(year == ''){
//			alert('please select year');
//			doc.year.focus();
//			return false;
//		}
	return true;
	//formString = setForm("pay_status");
	//url = "main.php?do=signin&action=summary&" + formString;
//	var ajax = new GHM.AJAX();
//	ajax.callPage(url, regfeaturedCallback, "GET");
}

function createFrame(secureUri){

	// IE does not allow the setting of id and name attributes as object
	// properties via createElement().  A different iframe creation
	// pattern is required for IE.
	var frameId = 'IframeId';
	if(window.ActiveXObject){
		var io = document.createElement('<iframe id="' + frameId + '" name="' + frameId + '" />');

		// IE will throw a security exception in an SSL environment if the
		// iframe source is undefined.
		if(typeof secureUri == 'boolean'){
			io.src = 'javascript:false';
		}
		else if(typeof secureURI == 'string'){
			// Deprecated
			io.src = secureUri;
		}
	}
	else{
		var io = document.createElement('iframe');
		io.id = frameId;
		io.name = frameId;
	}

	/*
	io.style.position = 'absolute';
	io.style.top	= '500px';
	io.style.left	= '200px';
	io.style.width	= '200px';
	io.style.height	= '200px';
	io.style.border	= '0px';
	*/

	io.style.position = 'absolute';
	io.style.top	= '-1000px';
	io.style.left	= '-1000px';
	io.style.width	= '0px';
	io.style.height	= '0px';
	io.style.border	= '0px';

	document.body.appendChild(io);
}

function setForm (formname){

	var mystring = "";

	var mycounter = 0;
	var myvalue	  = '';
	var myname	  = '';
	var tmpcounter = 0;
	if (formname){
		var theForm = eval("document." + formname);

		mylength = theForm.elements.length;
		//alert(mylength);
		while ( mycounter < mylength ) {

			mytype = theForm.elements[mycounter].type;

			if ( mytype != 'button' ) {


				if (mytype == 'radio' || mytype == 'Radio' ){
					if (theForm.elements[mycounter].checked == true){
						myname = theForm.elements[mycounter].name;
						myvalue = theForm.elements[mycounter].value;
					}
				}else if (mytype == 'checkbox' || mytype == 'CheckBox' ){
					if (theForm.elements[mycounter].checked == true){
						myname = theForm.elements[mycounter].name;
						myvalue = theForm.elements[mycounter].value;
					}
				}else{
					myname = theForm.elements[mycounter].name;
					myvalue = theForm.elements[mycounter].value;
				}

				if ( tmpcounter == 0 ) {

					myvalue = myvalue.replace(/&/g,"zzz");

					mystring = myname + "=" + myvalue;

				} else {

					myvalue = myvalue.replace(/&/g,"zzz");

					mystring = mystring + "&" + myname + "=" + myvalue;
				}
				tmpcounter = tmpcounter + 1;
			}

			mycounter = mycounter + 1;

		}
	}
	return mystring;
}

function check_all(obj){
	var all = document.all;
	for(var i=0;i<all.length;i++){
		var e = document.all[i];
		if(e.type == 'checkbox'){
			e.checked = obj.checked;
		}
	}
}
function check_all_music(obj){
	var all = document.all;
	for(var i=0;i<all.length;i++){
		var e = document.all[i];
		if(e.type == 'checkbox'){
			if(e.name == obj.name){
				e.checked = obj.checked;
			}
		}
	}
}
function playlist_select_all(folder, obj){
	setfolderName(folder);
	var all = document.all;
		str	= '';
	for(var i=0;i<all.length;i++){
		var e = document.all[i];
		if(e.type == 'checkbox'){
			if(e.name == obj){
				if(e.checked){
					if(e.value != 'Y'){
						if(str){
							str = str +'_'+ e.value;
						}else{
							str = e.value;
						}
					}
				}
			}
		}
	}
	if(obj == 'check_video'){
		str_type = ' video ';
	}else{
		str_type = ' mp3 ';
	}
	if(str == ''){
		alert('Please select any '+str_type+' play list');
	}else{
		url = "main.php?do=homepage&action=export_froogle&play_id="+str+"&folder="+folder;
		var ajax = new GHM.AJAX();
		ajax.callPage(url, playlistCallback, "GET");
	}
}
function playlist_select(folder){
	setfolderName(folder);
	var all = document.all;
		str	= '';
	for(var i=0;i<all.length;i++){
		var e = document.all[i];
		if(e.type == 'checkbox'){
			if(e.checked){
				if(e.value != 'Y'){
					if(str){
						str = str +'_'+ e.value;
					}else{
						str = e.value;
					}
				}
			}
		}
	}

	if(str == ''){
		alert('Please select any play list');
	}else{
		url = "main.php?do=homepage&action=export_froogle&play_id="+str+"&folder="+folder;
		var ajax = new GHM.AJAX();
		ajax.callPage(url, playlistCallback, "GET");
	}
}
function playlistCallback(responseText){
	//alert(responseText);
	//document.getElementById('player1').style.display = 'none';
	folder = getfolderName();
	singleplayer2(folder);
}

function check_coupon_code(){

	var doc = document.couponform;
	cuppon_code = doc.cuppon_code.value;
	if(cuppon_code == ''){
		alert('enter coupon code');
		doc.cuppon_code.focus();
		return false;
	}
	document.getElementById('cupponid').value = cuppon_code;
	url = "main.php?do=checkout&action=viewnew&couponid="+cuppon_code;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, couponCallback, "GET");
}

function couponCallback(responceText){

	if(responceText){
		document.getElementById('cupponcodeid').value = responceText;
		document.getElementById('couponerror').innerHTML = 'Your coupon information are added';
	}else{
		document.getElementById('couponerror').innerHTML = "You enter wrong coupon code";
	}
}
////////////// editor pick //////////////

////////////// editor pick //////////////
function open_save_playlist(folder){
	setfolderName(folder);
	var all = document.all;
		str	= '';
	for(var i=0;i<all.length;i++){
		var e = document.all[i];
		if(e.type == 'checkbox'){
			if(e.checked){
				if(e.value != 'Y'){
					if(str){
						str = str +'_'+ e.value;
					}else{
						str = e.value;
					}
				}
			}
		}
	}

	if(str == ''){
		alert('Please select any Video or Mp3');
	}else{
		setpopWidth(450);
		setpopHeight(600);
		setPopTitle('Create Playlist');
		url = "main.php?do=playlist&action=home&str="+str+"&folder="+folder;
		//alert(url);
		var ajax = new GHM.AJAX();
		//ajax.callPage(url, mainCallback, "GET");
		ajax.callPage(url, showuploadpopup, "GET");
	}

}

function playlist_save(){
	var doc				= document.playlistform;
		playlist_title	= doc.playlist_title.value;
		image_name		= doc.image_name.value;
		old_image		= doc.old_image.value;
		playlist_comment= doc.playlist_comment.value;

		if(playlist_title == ''){
			alert("Select playlist title");
			doc.playlist_title.focus();
			return false;
		}
		if(image_name == '' && old_image == ''){
			alert("Select playlist image");
			doc.image_name.focus();
			return false;
		}
		if(image_name != '' && image_name.indexOf(".jpg") == -1 && image_name.indexOf(".gif") == -1){
			alert("Select only jpg or gif image");
			doc.image_name.focus();
			return false;
		}
		if(playlist_comment == ''){
			alert("Insert comment");
			doc.playlist_comment.focus();
			return false;
		}

		if (!document.getElementById("IframeId")){
			createFrame();
		}

		var doc = document.playlistform;
		doc.target = "IframeId";
		doc.submit();

		document.getElementById("save_playlistid").style.display = "block";

}

function select_playlist_byid(pid){
	setpopWidth(450);
	setpopHeight(600);
	setPopTitle('Create Playlist');
	 url = "main.php?do=playlist&action=home&playid="+pid;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, showuploadpopup, "GET");
}

function delete_playlist(pid, page){
	setpopWidth(450);
	setpopHeight(600);
	setPopTitle('Create Playlist');
	url = "main.php?do=playlist&action=insert&delid="+pid+"&page="+page;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
}

function open_playlist(page){
	url = "main.php?do=playlist&action=view&page="+page;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("open_playlist(1);");
}

function checkUser(username , formid){
	XMLHttp = null;
	 if(window.XMLHttpRequest) {
		XMLHttp = new XMLHttpRequest();
	}
	else if(window.ActiveXObject) {
		XMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	if(formid == 1){
 		var doc = document.register_fan;
	}else if(formid == 2){
		var doc = document.artist_register;
	}else if(formid == 3){
		var doc = document.add_personalinfo;
	}
	else if(formid == 4){
		var doc = document.changepassword;
	}
		old_username = doc.old_username.value;

		if(username && username != old_username){
			var url_check = "main.php?do=signin&action=checkname&username="+username;
			// alert(url_check)
			XMLHttp.open("GET", url_check, true);
			XMLHttp.onreadystatechange = function test(){

				if(XMLHttp.readyState == 1) {
					document.getElementById("user_error").innerHTML = "<span class='Red2'>Wait..</span>";
				}
				if(XMLHttp.readyState == 4) {
					//alert(XMLHttp.responseText);
					if (XMLHttp.responseText == 'EXIST')
					{
						document.getElementById("user_error").innerHTML = "<span class='Red2'>username already exists, Please give another.</span>";
						doc.form_user.value = "F";
					}
					else{
						doc.form_user.value = "T";
						document.getElementById("user_error").innerHTML = "";
					}
				}
			}
			XMLHttp.send(null);
		}else{
			doc.form_user.value = "T";
			document.getElementById("user_error").innerHTML = "";
		}
 }



 function checkemail(emailid , formid){
	XMLHttp = null;
	 if(window.XMLHttpRequest) {
		XMLHttp = new XMLHttpRequest();
	}
	else if(window.ActiveXObject) {
		XMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	if(formid == 1){
 		var doc = document.register_fan;
	}else if(formid == 2){
		var doc = document.artist_register;
	}else if(formid == 3){
		var doc = document.add_personalinfo;
	}
		old_email = doc.old_email.value;

		if(emailid && emailid != old_email){
			var url_check = "main.php?do=signin&action=checkname&emailid="+emailid;

			XMLHttp.open("GET", url_check, true);
			XMLHttp.onreadystatechange = function test(){

				if(XMLHttp.readyState == 1) {
					document.getElementById("email_error").innerHTML = "<span class='Red2'>Wait..</span>";
				}
				if(XMLHttp.readyState == 4) {
					//alert(XMLHttp.responseText);
					if (XMLHttp.responseText == 'EXIST')
					{
						document.getElementById("email_error").innerHTML = "<span class='Red2'>email already exists, Please give another.</span>";
						doc.form_email.value = "F";
					}
					else{
						doc.form_email.value = "T";
						document.getElementById("email_error").innerHTML = "";
					}
				}
			}
			XMLHttp.send(null);
		}else{
			doc.form_email.value = "T";
			document.getElementById("email_error").innerHTML = "";
		}
 }

 function check_login(checkid){

	url = "main.php?do=playlist&action=save&checkid="+checkid;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, checkResponceText, "GET");
 }

 function check_loginuser(userid, pid){
	url = "main.php?do=playlist&action=save&userid="+userid+"&pid="+pid;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, checkResponceText, "GET");
 }

 function checkResponceText(responceText){
	if(responceText == 'playlist'){
		openplay_list_user(1);
	}else if(responceText){
		splitid = responceText.split("****");
		if(splitid[0] && splitid[1]){
			singleplayernew(splitid[0], splitid[1]);
		}
	}else{
		showalertMessage("You Must Be Logged-In to access control");
	}
 }

 function openplay_list_user(page){
	url = "main.php?do=playlist&action=insert&page="+page;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("openplay_list_user(1);");
 }

function playlist_detail(pid){
	url = "main.php?do=playlist&action=detail&pid="+pid;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
	addLink("playlist_detail('"+pid+"');");
 }

 function AddToPlaylist(pid, ptype){
	url = "main.php?do=playlist&action=addplaylist&pid="+pid+"&ptype="+ptype;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, PlaylistResponce, "GET");
 }

function openPlaylist(){
	//if(document.getElementById('playlistDivShow') == '' || document.getElementById('playlistDivShow') == 'undefined'){
	//	document.getElementById("FeaturedArtisePart").innerHTML = '<TABLE cellspacing="0" cellpadding="0" border="0" width="90%"><TR><td valign="top" align="left"><TABLE cellspacing="0" cellpadding="0" border="0" width="95%" height="680"><TR><TD background="images/feat_l.gif" WIDTH="25" HEIGHT="100%" BORDER="0" ALT="" style="background-repeat:no-repeat;background-color:#000000;"></TD><TD align="center" valign="top" bgcolor="#000000"><TABLE cellspacing="0" cellpadding="0" border="0" width="100%"><TR><TD COLSPAN="3" align="left"><IMG SRC="images/playlisttop.gif" WIDTH="193" HEIGHT="23" BORDER="0" ALT=""></TD></TR><TR><TD COLSPAN="3" align="center" HEIGHT="25" class="sel_gen" style="color:#ffffff">CREATE/SAVE PLAYLIST</TD></TR><TR><TD height="8"></TD></TR><TR><TD align="center" VALIGN="TOP" width="186"><div style="height:620px;overflow:auto;"><TABLE cellspacing="0" cellpadding="0" border="0" width="98%"align="center"><TR><TD height="70"></TD></TR><TR height="25"><TD align="center">Creating Your Playlist is Easy...</TD></TR><TR><TD height="10"></TD></TR><TR height="25"><TD align="left">1.&nbsp;Search for your favorite videos</TD></TR><TR><TD height="10"></TD></TR><TR height="25"><TD align="left">2.&nbsp;Drag or Add your videos to your lineup</TD></TR><TR><TD height="10"></TD></TR><TR height="25"><TD align="left">3.&nbsp;Save your playlist</TD></TR><TR><TD height="8"></TD></TR></table></div></TD></TR><TR><TD height="10"></TD></TR><tr><td align="center"><span class="white"><B>Save</B>&nbsp;&nbsp;<A HREF="javascript:clearPlaylist();" class="white" onclick="return window.confirm("do you want to delete all!")"><B>Clear All</B></A></td></tr></TABLE></TD><TD background="images/feat_r.gif" WIDTH="15" HEIGHT="100%" BORDER="0" ALT="" style="background-repeat:no-repeat;background-color:#000000;"></TD></TR><TR><TD COLSPAN="3"><IMG SRC="images/feat_b.gif" WIDTH="233" HEIGHT="14" BORDER="0" ALT=""></TD></TR></TABLE></TD></TR></TABLE>';
	//}
 }

function checkExistProduct(pid, ptype){
	url = "main.php?do=playlist&action=existproduct&pid="+pid+"&ptype="+ptype;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, releaseResponce, "GET");
 }

function releaseResponce(responceText){
	//alert(responceText);
	if(responceText == 'EXIST'){
		return false;
	}else{
		return true;
	}
}
 function PlaylistResponce(responceText){
	//alert(responceText);
	 if(responceText == 'EXIST'){
		alert('this video/music already exixts,add another');
	 }else{
		 document.getElementById("FeaturedArtisePart").innerHTML = responceText;
	 }
 }

function clearPlaylist(){
	url = "main.php?do=playlist&action=addplaylist&clear=Y";
	var ajax = new GHM.AJAX();
	ajax.callPage(url, PlaylistResponce, "GET");
}

function playlistDeletebyid(pid, ptype){
	url = "main.php?do=playlist&action=addplaylist&del_id="+pid+"&ptype="+ptype;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, PlaylistResponce, "GET");
}

function save_selected_playlist(){

	setpopWidth(450);
	setpopHeight(600);
	setPopTitle('Create Playlist');
	url = "main.php?do=playlist&action=home";
	//alert(url);
	var ajax = new GHM.AJAX();
	//ajax.callPage(url, mainCallback, "GET");
	ajax.callPage(url, showuploadpopup, "GET");
}

function openForgotPass(){

	url = "main.php?do=homepage&action=forgotpass";
	var ajax = new GHM.AJAX();
	ajax.callPage(url, responceForgotPassword, "GET");
	addLink("openForgotPass();");
}

function responceForgotPassword(responceText){
	document.getElementById('loginForgotPass').innerHTML = responceText;
}
function gologin(){
	url = "main.php?do=homepage&action=gologin";
	var ajax = new GHM.AJAX();
	ajax.callPage(url, responceGoLogin, "GET");
	addLink("gologin();");
}

function responceGoLogin(responceText){
	document.getElementById('loginForgotPass').innerHTML = responceText;
}

function checkforgotpassword(){
	if(!CheckInput("artist_pass.emailid","ENTER EMAIL")) return false;
	if (!badEmail("artist_pass.emailid","BAD EMAIL")) return false;
	var emailid = document.artist_pass.emailid.value;

	url = "main.php?do=homepage&action=forgotpass&emailid="+emailid;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, checkNewPassword, "GET");
}

function checkNewPassword(responceText){
	//alert(responceText);
	if(responceText == 'EXIST'){
		document.getElementById('pass_message').innerHTML = 'Invalid email-id, try again';
	}else{
		document.getElementById('pass_message').innerHTML = 'your password have been send to your mail-id';
	}
}


function featuredpay(){
	url = "main.php?do=signin&action=paynew";
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallback, "GET");
}


function changeArtistPrice(priceday){
	var oldprice = document.getElementById("old_featuredprice").value;

	totalprice = round(priceday*oldprice);
	document.getElementById("featuredpriceid").value = totalprice;
}

function round(x){
	return Math.round(x*10000)/10000;
}

function playlist_play(pid, ptype, autostart){

	url = "main.php?do=playlist&action=play_list&videoid="+pid+"&ptype="+ptype;
	var ajax = new GHM.AJAX();
	ajax.callPage(url, returnPlayerResponce, "GET");
}

function returnPlayerResponce(responceText){
	if(responceText){

		arraystr = responceText.split('****');
		file = arraystr[1];
		if(arraystr[0]){
			image = arraystr[0];
		}else{
			image = 'images/player_back.jpg';
		}

		if(file && image){
			document.getElementById("player1").innerHTML = getPlayer(file, image, true);
		}else{
			alert('video/music are not available');
		}
	}else{
		alert('video/music are not available');
	}
}

function checkschedularuser(){

	if(!CheckInput("saveuserdetails.sfname","ENTER First Name")) return false;
	if(!CheckInput("saveuserdetails.slname","ENTER Last Name")) return false;
	if(document.getElementById("editrecord").value=='t'){
		if(!CheckInput("saveuserdetails.suserpassword","ENTER Password")) return false;
	}

}
function showdirectorylist()
{
	var gener = document.getElementById("mgener").value;
	var subgener = document.getElementById("sub_category").value;
	pagination('main.php?do=shows&action=detailajax&genre='+gener+"&subganer="+subgener,'innerajaxpage')
}


//payment form validations here

function fillcardval(val)
{
	document.getElementById("fillcardvalue").value = val;
	 if(val=='paypal')
	 {
			 var frm = document.shoppingcart;
			document.shoppingcart.method = "post";
			document.shoppingcart.action = "main.php?do=cart&action=cartviewfinal&shoppingcarttype=paypal";
			document.shoppingcart.submit();
		 //alert("TEST");
		// return false;
	 }else{
		 document.getElementById("shoppingcarttype").value = val;
	 }
}




function CheckFormPay(){
	if(document.getElementById("fillcardvalue").value=='')
	{
		alert("Please select payment type");
		return false;
	}
 if (document.shoping_payment.card.value=="") {
       alert('you should select the card');
	   document.shoping_payment.card.focus();
		return false;
	}

	if (document.shoping_payment.cardnum.value=="") {
       alert('you should Enter the Card number');
	   document.shoping_payment.cardnum.focus();
		return false;
	}
	if(isNaN(document.shoping_payment.cardnum.value)){
			alert('Card Number must be in numeric!');
			document.shoping_payment.cardnum.focus();
		return false;
		}
	if(document.shoping_payment.cardnum.value.length < 16){
		alert('card number must be  in 16 digit !');
		document.shoping_payment.cardnum.focus();
		return false;
	}

	if (document.shoping_payment.cvvcode.value=="") {
       alert('you should Enter the cvv code number');
	   document.shoping_payment.cvvcode.focus();
		return false;
	}
	if(isNaN(document.shoping_payment.cvvcode.value)){
			alert('Cvv code must be in numeric!');
			document.shoping_payment.cvvcode.focus();
		return false;
		}
	if(document.shoping_payment.cvvcode.value.length < 3){
		alert('cvv code number must be  in 3 digit !');
		document.shoping_payment.cvvcode.focus();
		return false;
	}

	if (document.shoping_payment.month.value=="") {
       alert('you should Enter the month');
	   document.shoping_payment.month.focus();
		return false;
	}
	if (document.shoping_payment.year.value=="") {
       alert('you should Enter the year');
	   document.shoping_payment.year.focus();
		return false;
	}
	if (document.shoping_payment.name.value=="") {
       alert('Please check Name');
	   document.shoping_payment.name.focus();
		return false;
	}
	if (document.shoping_payment.street.value=="") {
       alert('you should Enter the Address');
	   document.shoping_payment.street.focus();
		return false;
	}
	if (document.shoping_payment.city.value=="") {
       alert('you should Enter the city');
	   document.shoping_payment.city.focus();
		return false;
	}

	if (document.shoping_payment.state.value=="") {
       alert('you should Enter the state');
	   document.shoping_payment.state.focus();
		return false;
	}

	if (document.shoping_payment.zip.value=="") {
       alert('you should Enter the zip code');
	   document.shoping_payment.zip.focus();
		return false;
	}

	if (document.shoping_payment.country.value=="") {
       alert('you should Enter the country');
	   document.shoping_payment.country.focus();
		return false;
	}
}
function changeajaxcaturl(val)
{
	pagination('main.php?do=adminalbum&action=showsubgener&generid='+val,'showsubg');
}

function searchvalue()
{
	var searchv = document.getElementById("searchvalueinlist").value;
	if(searchv=='')
	{
			alert("Please enter text of searching value");
			return false;
	}
	pagination_scheduler_paging('main.php?do=adminalbum&action=managepagingajax&showtype=search&searchvalue='+searchv,'showvideoadschannel')
}
function setselectedid(id,type,ival)
{

	document.getElementById("selectedid").value = id;
	document.getElementById("selectedtype").value = type;
	document.getElementById("ivalue").value = ival;
}
function setselectedidHome(id,type,ival,page)
{

	document.getElementById("selectedid").value = id;
	document.getElementById("selectedtype").value = type;
	document.getElementById("ivalue").value = ival;
	document.getElementById("pagevalue").value = page;
}
function paginationdragdrop(url,divid)
{	var ajax = new GHM.AJAX();

  	ajax.callPage(url, mainCallbackdragdrop, "GET",divid);
}

function mainCallbackdragdrop(responseText,divid)
{

  	document.getElementById(divid).innerHTML  = responseText;
//	setTimeout("draggable()", 1000);
	document.getElementById("shov").value='f';
	if(document.getElementById("YMusicRegion_T3_R2C1_R2")){
		carouselLoad();
	}
}


function deleteplaylist(id)
{
	if(id=='')
	{
		var conf = window.confirm("Are you sure you want to delete all the record from playlist");
		if(conf){
		paginationdragdrop('main.php?do=allvideo&action=dropedlist&saveintemplist=delete','dragdroplistinner');
		document.getElementById("shov").value='t'
		totl = document.getElementById("leftotal").value
		document.getElementById("droptotalvideo").value = parseInt(document.getElementById("droptotalvideo").value)-parseInt(totl)
		}
	}
	else{
	var conf = window.confirm("Are you sure you want to delete the record from playlist");
	if(conf){
	paginationdragdrop('main.php?do=allvideo&action=dropedlist&saveintemplist=delete&id='+id,'dragdroplistinner');
	document.getElementById("shov").value='t'
	document.getElementById("droptotalvideo").value = parseInt(document.getElementById("droptotalvideo").value)-1;
	}
	}
}
function deleteplaylistajax(id,playid)
{
	if(id=='')
	{
		var conf = window.confirm("Are you sure you want to delete all the record from playlist");
		if(conf){
		paginationdragdrop('main.php?do=allvideo&action=dropedlist&saveintemplist=delete','changedplaylist');
		totl = document.getElementById("leftotal").value
		document.getElementById("shov").value='t'
		document.getElementById("droptotalvideo").value = parseInt(document.getElementById("droptotalvideo").value)-parseInt(totl)
		}
	}
	else{
	var conf = window.confirm("Are you sure you want to delete the record from playlist");
	if(conf){
	paginationdragdrop('main.php?do=allvideo&action=savedplaylistajax&saveintemplist=delete&id='+id+"&playlistid="+playid,'changedplaylist');
	document.getElementById("shov").value='t'
	document.getElementById("droptotalvideo").value = parseInt(document.getElementById("droptotalvideo").value)-1;
	}
	}
}
function saveplaylist()
{
	var totalpaidvidoeandmusic='';
//	var totalpaidvidoeandmusic = document.getElementById("totaldownloadedvideo").value;
	var playlistid = document.getElementById("playlistid").value;
	if(playlistid=='') {
		alert("Please Select any one playlist");
		return false;
	}
	else{
		if(totalpaidvidoeandmusic>0)
		{
			var conf = window.confirm("Some Video or Music that you want to add in playlist is paid. do you want to purchase");
			if(conf)
			{

				//window.location.href = spath+"main.php?do=cart&action=cartview&dragdroplist=draggid&playlistid="+playlistid;
			}

		}else{
	 	paginationdragdrop('main.php?do=allvideo&action=savedropedlist&saveintemplist=savepernament&playlistid='+playlistid,'dragdroplistinner');
		}
	}
}

function filltype(typ)
{
	document.getElementById("dragyesno").value =typ;
}
function showval(t)
{

 	document.getElementById("shov").value = t
}


function paginationforfrontdragdrop(url,divid)
{	var ajax = new GHM.AJAX();
 	document.getElementById("leftotal").value = 0;
  	ajax.callPage(url, mainCallbackforfrontdragdrop, "GET",divid);
}

function mainCallbackforfrontdragdrop(responseText,divid)
{
	document.getElementById("dragdroplistinner").style.display='';
	document.getElementById("schedulerplaylist").style.display='none';
		document.getElementById("ul2").style.backgroundColor='';
	document.getElementById("shov").value='f';

  	document.getElementById(divid).innerHTML  = responseText;
	var left = 0;
	var tot  = parseInt(document.getElementById("droptotalvideo1").value);
	var left  = parseInt(document.getElementById("leftotal").value);

	var totn = tot+left;
	document.getElementById("droptotalvideo").value = totn;
	//setTimeout("draggable()", 1000);


	//var script = 'http://192.168.0.181/gethitmusic/js/addthis.js#domready=1';
	var script = spath+'js/addthis.js';
	//alert(script)
		if (window.addthis){
			window.addthis = null;
		}
		$.getScript( script );


	document.getElementById("showajaxloading").style.display='none';

	//setTimeout("timedMsg()","3000")
	document.getElementById("dragid").value='';


	if(document.getElementById("YMusicRegion_T3_R2C1_R2")){
		carouselLoad();
	}
}
 function savepalylist()
 {
	 if(document.getElementById("playlist").value=='')
	 {
		 alert("Select Playlist");
		 return false;
	 }

	 var selectedproductid = document.getElementById("selectedproductied").value;
	 var selectedplaylistype = document.getElementById("selectedplaylistype").value;
	 var totalcheck=0;
	 if(selectedplaylistype=='album')
	 { var ar = new Array();

		 totalcheckrecods = document.getElementsByName("music[]");

		  for (var i in totalcheckrecods)
		  	{
  		 		if(totalcheckrecods[i].checked==true)
				{
					if(totalcheckrecods[i].value!='' && totalcheckrecods[i].value!=undefined){
					ar.push(totalcheckrecods[i].value);
					totalcheck=1;
					}

				}
			}
			if(totalcheck==0)
			{

				 for (var i in totalcheckrecods)
					{

						if(totalcheckrecods[i].value!='' && totalcheckrecods[i].value!=undefined){
						 	ar.push(totalcheckrecods[i].value);
						}


					}
			}
 		  var fields1 = "&listid="+document.getElementById("playlist").value+"&productid="+selectedproductid+"&selectedplaylistype="+selectedplaylistype+"&checkedmusic="+ar;
	 }else{
	 var fields1 = "&listid="+document.getElementById("playlist").value+"&productid="+selectedproductid+"&selectedplaylistype="+selectedplaylistype

	 }
	 url = spath+"main.php?do=myaccount&action=saveintoplaylist"+fields1;
	divid = "shownewlist";
	//alert(url);

 	pagination(url,divid);

 styledPopupClose_playlist(selectedplaylistype)

 }
function savepalylisttime()
{
	if(document.getElementById("title").value=='')
	{
		alert("Please enter title");
		return false;
	}
	//if(document.getElementById("publishtype3").value=='')
//	{
//		alert("Please Select publish type");
//		return false;
//	}
	if(document.getElementById("comment").value=='')
	{
		alert("Please enter comment");
		return false;
	}
	var fields1 = "&title="+document.getElementById("title").value+"&publishtype=PR&comment="+document.getElementById("comment").value;
	url = "main.php?do=allvideo&action=saenewplaylist"+fields1;
	divid = "shownewlist";
	pagination(url,divid);
	document.getElementById("styled_popup").style.display = "none";
}

function filltype(id)
{

document.getElementById("publishtype3").value = id;
}

function changeplaylist(va)
{
	var url = "main.php?do=allvideo&action=savedplaylistajax&playlistid="+va;
	//alert(url)
	var divid = "changedplaylist";
	paginationdragdrop(url,divid);
}
//////////////////Playlist Functions

 var currentplayid=0;
 var currentplaystate;

 function pagination_listing_player_genre(url,divid)
{	var ajax = new GHM.AJAX();
 	ajax.callPage(url, mainCallback_listing_player_genre, "GET",divid);
}
var spath3='';
function mainCallback_listing_player_genre(responseText,divid)
{

  	document.getElementById(divid).innerHTML  = responseText;
	firstid = document.getElementById("firstid").value;
	firstpathid = document.getElementById("firstpathid").value;
	spath3 = "Pop";


	var s = firstpathid;
	var last3 = s.substring(s.length-3);

	var playid = firstid;
	 if(last3=='mp3')
	 {
		var imgValue = document.getElementById("imgpath"+playid).value;
		var artistname = document.getElementById("artistname"+playid).value;
		var genername = document.getElementById("genername"+playid).value;
		var releaseedate = document.getElementById("releaseedate"+playid).value;
		var albunmname = document.getElementById("albunmname"+playid).value;
		var description = document.getElementById("description"+playid).value;
		ShowArtistDetail(spath+imgValue,artistname,genername,releaseedate,albunmname,description)
	 }

	PlayPlaylistvideo(firstpathid,firstid);

	if(document.getElementById("YMusicRegion_T3_R2C1_R2")){
		carouselLoad();
	}
}


 function pause_js()
 {
	 currentplaystate = "pause";
	 document.getElementById("playpause_"+currentplayid).src=spath+"images/Play_button.png";
 }

 function play_js()
 {
	 currentplaystate = "play";
     document.getElementById("playpause_"+currentplayid).src=spath+"images/pause.png";
 }

 function  nowandnexttitle2(now,next)
 {
	getMovieName("GetHitMusic").nowandnexttitle(now,next);
 }
function PLTitleDisc(title,descr)
{
	getMovieName("GetHitMusic").PLTitleDisc(title,descr);
}
function PlayPlaylistvideo(palypath,id)
{

	 if(spath2 == 'Popplist')
	 {
		 titlesplaylist = document.getElementById("playtitlesnownext").value;
		 if(titlesplaylist!=0){
   		titlesplaylist1 = titlesplaylist.split(",");
		 playid = document.getElementById("playids").value;
   		playids = playid.split(",");


		for(i=0;i<playids.length;i++)
		{
			//alert(titlesplaylist1[i])
			//alert(playids[i]+"=="+id)
			if(playids[i]!=''){
			 if(playids[i]==id){
				 now1 = titlesplaylist1[i]
				 if(titlesplaylist1[i+1]=='')
				 nex = 'None';
				 else
				 nex = titlesplaylist1[i+1];
			 }
			}


  		}
		nowandnexttitle2(now1,nex)

	 }
	 }
 	if(currentplayid == id)
	{
		if(currentplaystate == "play")
		{
 			pause_js();
			getMovieName("GetHitMusic").PauseVideofun();
		}
		else
		{
			play_js();
			getMovieName("GetHitMusic").PlayVidoefun();
		}
	}
	else
	{

		if(currentplayid!=0)
		{
			if(currentplayid!=id){
 				document.getElementById("playpause_"+id).src=spath+"images/Play_button.png";
				if(document.getElementById("isAjax").value==1)
				{currentplayid = id;
				document.getElementById("isAjax").value=0;
				}
				if(currentplaystate == "play")
					{
						pause_js();
						getMovieName("GetHitMusic").PauseVideofun();
					}
					else
					{
						play_js();
						getMovieName("GetHitMusic").PlayVidoefun();
					}
			}else{
			document.getElementById("playpause_"+currentplayid).src=spath+"images/Play_button.png";
			}
			//document.getElementById("playpause_"+currentplayid).src=spath+"images/Play_button.png";
		}else{
			//alert(spath2)
			//spath2 = document.URL;
			 if(spath2.indexOf("album")!=-1)
				{
					va = va[0].split("album");
					spath = va[0];

				 }

			document.getElementById("playpause_"+id).src=spath+"images/Pause_button.png";

		}

		currentplayid = id;
		play_js();

	  	getMovieName("GetHitMusic").PlayPlaylistvideo(palypath,id);
	}
}

function Replayvideo(palypath,id)
{
	if(currentplayid!=0)
	{
		document.getElementById("playpause_"+currentplayid).src=spath+"images/Play_button.png";
	}
	currentplayid = id;
	play_js();
	getMovieName("GetHitMusic").PlayPlaylistvideo(palypath,id);
}

function ShowArtistDetail(image,artistname,gener,releaseon,album,des)
{
	 //alert(image+"\n"+artistname+"\n"+gener+"\n"+releaseon+"\n"+album+"\n"+des)
  	getMovieName("GetHitMusic").ShowArtistDetail(image,artistname,gener,releaseon,album,des);

}

function Switchtochannel()
{
	getMovieName("GetHitMusic").Switchtochannel();
}

function showEndScreen(id)
{
	getMovieName("GetHitMusic").showEndScreen(id);
}

function getMovieName(movieName)
{
	if (navigator.appName.indexOf("Microsoft") != -1)
	{
		return window[movieName]
	}
	else
	{
		return document[movieName]
	}
}
function playnextfromplayer()
{
	getMovieName("GetHitMusic").PlayPlaylistvideo("Butterfly.flv");
}
function playprefromplayer()
{
	getMovieName("GetHitMusic").PlayPlaylistvideo("1204193443.mov");
}

function show_layer(value)
{
if(value=='new') {
	document.getElementById("styled_popup").style.display='block';

	pagination(spath+'main.php?do=allvideo&action=popuplist','wrapper123' );
	}
}

function show_layer_forOrderSave(value,productid,type)
{
if(value=='new')
{

	if(type=='video')
	{	document.getElementById("styled_popup").style.display='block';
		document.getElementById("styled_popup_album").style.display='none';
		document.getElementById("styled_popup_music").style.display='none';
		 id = "wrapper123";
	}
	if(type=='album')
	{	document.getElementById("styled_popup").style.display='none';
		document.getElementById("styled_popup_album").style.display='block';
		document.getElementById("styled_popup_music").style.display='none';
		id = "wrapper1234";

	}
	if(type=='music')
	{	document.getElementById("styled_popup").style.display='none';
		document.getElementById("styled_popup_album").style.display='none';
		document.getElementById("styled_popup_music").style.display='block';
		id = "wrapper1235";
	}

	pagination(spath+'main.php?do=myaccount&action=addtoplaylist&type='+type+"&productid="+productid,id );
	}
}

function styledPopupClose() {
	document.getElementById("playlistid").selectedIndex=0;
  document.getElementById("styled_popup").style.display = "none";
}
function styledPopupClose_playlist(type)
{
	if(type=='video')
	document.getElementById("styled_popup").style.display = "none";
	if(type=='album')
	document.getElementById("styled_popup_album").style.display = "none";
	if(type=='music')
	document.getElementById("styled_popup_music").style.display = "none";

}
function dragtypeid(id)
{
	document.getElementById("dragid").value = id;
}

function paginationforfrontdragdrop_album(url,divid)
{
	var ajax = new GHM.AJAX();
	ajax.callPage(url, mainCallbackforfrontdragdrop_album, "GET",divid);
}
function mainCallbackforfrontdragdrop_album(responseText,divid)
{

	var script = spath+'js/addthis.js';

		if (window.addthis){
			window.addthis = null;
		}
		$.getScript( script );

		document.getElementById(divid).innerHTML  = responseText;
		getelementfromid()
}



function paginationforfrontdragdrop_ajax(url,divid)
{	var ajax = new GHM.AJAX();
 	document.getElementById("leftotal").value = 0;
	document.getElementById("isAjax").value = 1;
  	ajax.callPage(url, mainCallbackforfrontdragdrop_ajax, "GET",divid);
}

function mainCallbackforfrontdragdrop_ajax(responseText,divid)
{

  	document.getElementById(divid).innerHTML  = responseText;
	 var left = 0;
	 var tot  = parseInt(document.getElementById("droptotalvideo1").value);
	var left  = parseInt(document.getElementById("leftotal").value);

	var totn = tot+left;
	document.getElementById("droptotalvideo").value = totn;
	//setTimeout("draggable()", 1000);


	//var script = 'http://192.168.0.181/gethitmusic/js/addthis.js#domready=1';
	var script = spath+'js/addthis.js';


		if (window.addthis){
			window.addthis = null;
		}
		$.getScript( script );


	(function() {

var Dom = YAHOO.util.Dom;
var Event = YAHOO.util.Event;
var DDM = YAHOO.util.DragDropMgr;
var listul2='';
//////////////////////////////////////////////////////////////////////////////
// example app
//////////////////////////////////////////////////////////////////////////////
YAHOO.example.DDApp = {
    init: function() {

       	var totvide = parseInt(document.getElementById("droptotalvideo").value);
		var leftotal = parseInt(document.getElementById("leftotal").value);
		var newto = leftotal+totvide;
        var rows=newto,cols=2,i,j;
        for (i=1;i<cols+1;i=i+1) {
            new YAHOO.util.DDTarget("ul"+i);
        }

        for (i=0;i<cols+1;i=i+1) {
            for (j=0;j<rows+1;j=j+1) {
                new YAHOO.example.DDList("li" + i + "_" + j);
            }
        }


        Event.on("showButton", "click", this.showOrder);
        Event.on("switchButton", "click", this.switchStyles);
    },

    showOrder: function() {
        var parseList = function(ul, title) {
            var items = ul.getElementsByTagName("li");
            var out = title + ": ";
            for (i=0;i<items.length;i=i+1) {
                out += items[i].id + " ";
            }
            return out;
        };

        var ul1=Dom.get("ul1"), ul2=Dom.get("ul2");
        //alert(parseList(ul1, "List 1") + "\n" + parseList(ul2, "List 2"));

    },

    switchStyles: function() {
        Dom.get("ul1").className = "draglist_alt";
        Dom.get("ul2").className = "draglist_alt";
    }
};

//////////////////////////////////////////////////////////////////////////////
// custom drag and drop implementation
//////////////////////////////////////////////////////////////////////////////

YAHOO.example.DDList = function(id, sGroup, config) {

    YAHOO.example.DDList.superclass.constructor.call(this, id, sGroup, config);

    this.logger = this.logger || YAHOO;
    var el = this.getDragEl();
    Dom.setStyle(el, "opacity", 0.67); // The proxy is slightly transparent

    this.goingUp = false;
    this.lastY = 0;
};

YAHOO.extend(YAHOO.example.DDList, YAHOO.util.DDProxy, {

    startDrag: function(x, y) {
        this.logger.log(this.id + " startDrag");

        // make the proxy look like the source element
        var dragEl = this.getDragEl();
        var clickEl = this.getEl();

        Dom.setStyle(clickEl, "visibility", "");
		document.getElementById("showajaxloading").style.display='none';
 		//var val = "<div id='showajax1'><div>aaaaaaaaaaaaaaaaaaaaaaaaaaa</div></div>";
 		 val = "<li class=\" OnRollOut FloatLeft\" id=\"li1_"+ivalue+"\" style=\"width:225px; height:20px; padding:0 0 0 0px;  margin:0px 2px 0px 2px;\"><div class=\"MarginTop4\"><div class=\"Ashley White\"><strong><a href=\""+spath+"main.php?do=artistdetail&action=detailsartist&artistid="+title+"\" class=\"White\">"+title+"</a></strong></div><div class=\"FloatLeft  DragListingPicBg_2 MarginTop6 imgclass\"><img alt=\"img\" src=\'"+image+"\' class=\"Margin5\" width=\"35\" height=\"35\" /></div><div class=\"FloatLeft MarginLeft5 AritstMatter\" style=\"width:127px;\"><div class=\"TitleHeading\" style=\"width:140px; height:25px;\"><a href=\""+spath+"main.php?do=artistdetail&action=detailsartist&artistid="+userid+"\" class=\"White\">"+artistname+"</a></div></div></li>";

       // dragEl.innerHTML = clickEl.innerHTML;

		  dragEl.innerHTML = val;
		//document.getElementById("dragdi").innerHTML  = clickEl.innerHTML;
 		 var width = Dom.getStyle(clickEl, "width");
		var n = width.split("px");
		width = parseInt(n[0])+parseInt(70)+"px";
		var height = Dom.getStyle(clickEl, "height");
 		var n = height.split("px");
		height = (parseInt(n[0])-parseInt(30))+"px";
    	 Dom.setStyle(dragEl, "color", Dom.getStyle(clickEl, "color"));
        Dom.setStyle(dragEl, "backgroundColor", "#525252");
		Dom.setStyle(dragEl, "background-image:url", "("+spath+"images/bg_gray_2.jpg); background-repeat:repeat-x");
        Dom.setStyle(dragEl, "border", "1px solid gray");
		Dom.setStyle(dragEl, "height", height);
		Dom.setStyle(dragEl, "width", width);
		Dom.setStyle(dragEl, "list-style", "none");

    },

    endDrag: function(e) {


        var srcEl = this.getEl();
        var proxy = this.getDragEl();

        // Show the proxy element and animate it to the src element's location
        Dom.setStyle(proxy, "visibility", "");

        var a = new YAHOO.util.Motion(
            proxy, {
                points: {
                    to: Dom.getXY(srcEl)
                 }
            },
            0.2,
            YAHOO.util.Easing.easeOut
        )

        var proxyid = proxy.id;
        var thisid = this.id;

        // Hide the proxy and show the source element when finished with the animation
        a.onComplete.subscribe(function() {
                Dom.setStyle(proxyid, "visibility", "hidden");
                Dom.setStyle(thisid, "visibility", "");
             });
        a.animate();
 		setTimeout('show1()',50)

    },

    onDragDrop: function(e, id) {

        // If there is one drop interaction, the li was dropped either on the list,
        // or it was dropped on the current location of the source element.

        if (DDM.interactionInfo.drop.length === 1) {

            // The position of the cursor at the time of the drop (YAHOO.util.Point)
            var pt = DDM.interactionInfo.point;

            // The region occupied by the source element at the time of the drop
            var region = DDM.interactionInfo.sourceRegion;

            // Check to see if we are over the source element's location.  We will
            // append to the bottom of the list once we are sure it was a drop in
            // the negative space (the area of the list without any list items)
            if (!region.intersect(pt)) {
                var destEl = Dom.get(id);
                var destDD = DDM.getDDById(id);
				var newid = destDD;

				if(newid=='DDTarget ul2')
				{
						document.getElementById("shov").value='f';
 				}

				destEl.appendChild(this.getEl());

                destDD.isEmpty = false;
                DDM.refreshCache();
            }

        }
    },

    onDrag: function(e) {

        // Keep track of the direction of the drag for use during onDragOver
        var y = Event.getPageY(e);

        if (y < this.lastY) {
            this.goingUp = true;
        } else if (y > this.lastY) {
            this.goingUp = false;
        }

        this.lastY = y;
    },

    onDragOver: function(e, id) {

        var srcEl = this.getEl();
        var destEl = Dom.get(id);

        // We are only concerned with list items, we ignore the dragover

        // notifications for the list.
        if (destEl.nodeName.toLowerCase() == "li") {
            var orig_p = srcEl.parentNode;

            var p = destEl.parentNode;


            if (this.goingUp) {
                p.insertBefore(srcEl, destEl); // insert above
            } else {
                p.insertBefore(srcEl, destEl.nextSibling); // insert below
            }

            DDM.refreshCache();
        }
    }
});

Event.onDOMReady(YAHOO.example.DDApp.init, YAHOO.example.DDApp, true);

})();


	document.getElementById("showajaxloading").style.display='none';

	document.getElementById("shov").value='f';
	setTimeout("timedMsg()","3000")
	document.getElementById("dragid").value='';


	if(document.getElementById("YMusicRegion_T3_R2C1_R2")){
		carouselLoad();
	}
}
function timedMsg()
{
	//document.getElementById("shov").value='t'
}

function loadplaylistinpalyer(playlistid)
{

	document.getElementById("dragdroplistinner").style.display='';
	document.getElementById("schedulerplaylist").style.display='none';
	divid = "dragdroplistinner";
 	pagination_listing("main.php?do=allvideo&action=viewplaylist&selectedid="+playlistid,divid)

}



function pagination_listing(url,divid)
{	var ajax = new GHM.AJAX();
 	ajax.callPage(url, mainCallback_listing, "GET",divid);
}
function mainCallback_listing(responseText,divid)
{

  	document.getElementById(divid).innerHTML  = responseText;



	if(document.getElementById("YMusicRegion_T3_R2C1_R2")){
		carouselLoad();
	}
}

function NextPlaylistvideo(id)
{

	var playlistarray = new Array();
	var playlistpatharray = new Array();
	var totalides='';
	var videopath='';
	var selectgen = document.getElementById("genselect").value;
	if(spath2.indexOf("album")!=-1)
	{
		va = va[0].split("album");
		spath2 = 'Popplist';

	 }
	  if(spath3=='Pop' ){
	  totalides = document.getElementById("playids").value;
   		totalides = totalides.split(",");
 	  videopath = document.getElementById("playpathid").value;
	videopath =  videopath.split(",");
	}
 	if(spath2=='Popplist' ){
	  totalides = document.getElementById("playids").value;
  	totalides = totalides.split(",");
 	  videopath = document.getElementById("playpathid").value;
	videopath =  videopath.split(",");
	}
	if(selectgen==1){
	 totalides = document.getElementById("playids").value;
   	totalides = totalides.split(",");
 	  videopath = document.getElementById("playpathid").value;
	videopath =  videopath.split(",");

	}

	var shifcnanel='f';

 	for(i=0;i<videopath.length;i++)
	{
		if(videopath[i]!='')
			playlistpatharray.push(videopath[i]);
	}
	for(i=0;i<totalides.length;i++)
	{
		if(totalides[i]!='')
			playlistarray.push(totalides[i]);
	}

	var isFound=false;
	var lastplayid = id;
	for(i=0;i<playlistarray.length;i++)
	{

		if(playlistarray[i]!='')
		{
			if(playlistarray[i]==id)
			{
				var repeat=document.getElementById("Repet").value;

				if(repeat==1)
				{  	var s = playlistpatharray[i];
					var last3 = s.substring(s.length-3);

					var playid = playlistarray[i];
  					 if(last3=='mp3')
					 {
					 	var imgValue = document.getElementById("imgpath"+playid).value;
  						var artistname = document.getElementById("artistname"+playid).value;
						var genername = document.getElementById("genername"+playid).value;
						var releaseedate = document.getElementById("releaseedate"+playid).value;
						var albunmname = document.getElementById("albunmname"+playid).value;
						var description = document.getElementById("description"+playid).value;
 						ShowArtistDetail(spath+imgValue,artistname,genername,releaseedate,albunmname,description)
					 }
					 return Replayvideo(playlistpatharray[i],playlistarray[i]);
					//return PlayPlaylistvideo(playlistpatharray[i],playlistarray[i]);
				}
				else if((i+1)<playlistarray.length)
				{

					var s = playlistpatharray[i+1];
					var last3 = s.substring(s.length-3);

					var playid = playlistarray[i+1];

 					 if(last3=='mp3')
					 {

					 	var imgValue = document.getElementById("imgpath"+playid).value;


 						var artistname = document.getElementById("artistname"+playid).value;
						var genername = document.getElementById("genername"+playid).value;
						var releaseedate = document.getElementById("releaseedate"+playid).value;
						var albunmname = document.getElementById("albunmname"+playid).value;
						var description = document.getElementById("description"+playid).value;
 						ShowArtistDetail(spath+imgValue,artistname,genername,releaseedate,albunmname,description)
					 }
  					return PlayPlaylistvideo(playlistpatharray[i+1],playlistarray[i+1]);

				}
 			}
		}
 	}

		if(isFound==false)
		{

				var loop=0;
				if(spath3=='Pop' ){
				var loop=document.getElementById("loop").value;
				}
				if(spath2=='Popplist' ){
				var loop=document.getElementById("loop").value;
				}

				if(selectgen==1)
				{
				loop=document.getElementById("loop").value;
				}

				if(loop==1)
				{
					if(playlistarray.length>0){
					var s = playlistpatharray[0];
					var last3 = s.substring(s.length-3);
					var playid = playlistarray[0];
 					 if(last3=='mp3')
					 {
					 	var imgValue = document.getElementById("imgpath"+playid).value;
 						var artistname = document.getElementById("artistname"+playid).value;
						var genername = document.getElementById("genername"+playid).value;
						var releaseedate = document.getElementById("releaseedate"+playid).value;
						var albunmname = document.getElementById("albunmname"+playid).value;
						var description = document.getElementById("description"+playid).value;
 						ShowArtistDetail(spath+imgValue,artistname,genername,releaseedate,albunmname,description)
					 }
					}
					if(playlistarray.length>0)
						return PlayPlaylistvideo(playlistpatharray[0],playlistarray[0]);
				}
				else
				{
					 var popupornot = document.getElementById("popuwindowplayer").value;

					 if(popupornot==1)
					 {
						 window.close();
					 }

						setTimeout("",10000);
						document.getElementById("playpause_"+lastplayid).src=spath+"images/Play_button.png";
						var chiud = document.getElementById("playchaneelid").value;
						document.getElementById("dragdroplistinner").style.display='none';
						document.getElementById("schedulerplaylist").style.display='';
						ShowTracks(chiud)
						currentplayid=0;
						//Switchtochannel();
						//alert(id)
						showEndScreen(id);

				}
 		}
 }




function PrePlaylistvideo(id)
{


	var playlistarray = new Array();
	var playlistpatharray = new Array();
	if(spath2=='Popplist' || spath2=='detail'){
	var totalides = document.getElementById("playids").value;
	//alert("Before split="+totalides);
 	totalides = totalides.split(",");
	//alert("split="+totalides.length);
	var videopath = document.getElementById("playpathid").value;
	videopath =  videopath.split(",");
	}
	var shifcnanel='f';

	var lastplayid = id;
	for(i=0;i<videopath.length;i++)
	{
		if(videopath[i]!='')
			playlistpatharray.push(videopath[i]);
	}
	for(i=0;i<totalides.length;i++)
	{
		if(totalides[i]!='')
			playlistarray.push(totalides[i]);
	}

	var isFound=false;
	for(i=0;i<playlistarray.length;i++)
	{

		if(playlistarray[i]!='')
		{
			if(playlistarray[i]==id)
			{
				var repeat=document.getElementById("Repet").value;
				if(repeat==1)
				{
					return PlayPlaylistvideo(playlistpatharray[i],playlistarray[i]);
				}
				else if((i-1)>-1)
				{
					var s = playlistpatharray[i-1];
					var last3 = s.substring(s.length-3);
					//alert(last3)
					var playid = playlistarray[i-1];
					 if(last3=='mp3')
					 {
						 var imgValue = document.getElementById("imgpath"+playid).value;
						var artistname = document.getElementById("artistname"+playid).value;
						var genername = document.getElementById("genername"+playid).value;
						var releaseedate = document.getElementById("releaseedate"+playid).value;
						var albunmname = document.getElementById("albunmname"+playid).value;
						var description = document.getElementById("description"+playid).value;

						ShowArtistDetail(spath+imgValue,artistname,genername,releaseedate,albunmname,description)
					 }
 					return PlayPlaylistvideo(playlistpatharray[i-1],playlistarray[i-1]);
				}
 			}
		}
 	}

		if(isFound==false)
		{
				var loop=0;
				if(spath2=='Popplist'){
				var loop=document.getElementById("loop").value;
				}
				if(loop==1)
				{
					if(playlistarray.length>0)
					return 	PlayPlaylistvideo(playlistpatharray[0],playlistarray[0]);
				}
				else
				{

					 if(shifcnanel=='t'){

						document.getElementById("playpause_"+lastplayid).src=spath+"images/Play_button.png";
						setTimeout("",10000);
						document.getElementById("dragdroplistinner").style.display='none';
						document.getElementById("schedulerplaylist").style.display='';
						Switchtochannel();
						//showEndScreen();


					 }
				}
 		}
 }
function navagation_details2(url,divid,processid)
{	var ajax = new GHM.AJAX();
//	document.getElementById(processid).innerHTML = "<img src='images/18-1.gif' height='9' >";
        url = "http://www.gethitmusic.com/"+url;
  	 ajax.callPage(url, mainCallback_detail, "GET",divid);
  	document.getElementById(processid).innerHTML = "";
}
function navagation_details(url,divid,processid)
{	var ajax = new GHM.AJAX();
//	document.getElementById(processid).innerHTML = "<img src='images/18-1.gif' height='9' >";

  	 ajax.callPage(url, mainCallback_detail, "GET",divid);
  	document.getElementById(processid).innerHTML = "";
}
function mainCallback_detail(responseText,divid)
{
   	document.getElementById(divid).innerHTML  = responseText;
//	alert(responseText)
  	jQuery(".gallery a[rel^='prettyPhoto']").prettyPhoto({theme:'facebook'});
  	if(document.getElementById("YMusicRegion_T3_R2C1_R2")){
		carouselLoad();
	}
}
function navagation_details_myphoto(url,divid)
{	var ajax = new GHM.AJAX();
  	 ajax.callPage(url, mainCallback_detail_myphoto, "GET",divid);
  	document.getElementById(processid).innerHTML = "";
}
function mainCallback_detail_myphoto(responseText,divid)
{
   	document.getElementById(divid).innerHTML  = responseText;
  	 $(".gallery a[rel^='prettyPhoto']").prettyPhoto({theme:'facebook'});
  	if(document.getElementById("YMusicRegion_T3_R2C1_R2")){
		carouselLoad();
	}
}

function ShowTracks(channelid)
{

	var url = document.URL;
	var va = url.split("main");

	var newva1='';
	if(va[1]!=undefined)
	{
		newva = va[1].split("&action");
		newva1 = newva[0];

 	}
 	if(url.indexOf("main.php?do")!=-1)
	{
		va = url.split("main.php?do");
		spath = va[0];

	}else if(url.indexOf("album/")!=-1)
	{
		va = url.split("album/");
		spath = va[0];
	}else
	{
		if(url.indexOf("gethitmusic.com/")!=-1)
		{
			va = url.split("gethitmusic.com/");
			spath = va[0]+"gethitmusic.com/";
		}else{
		spath = url;
		}

	}

	document.getElementById("playchaneelid").value = channelid;
	if(newva1=='' || newva1!='.php?do=adminalbum')
	{
	url = spath+"main.php?do=homepage&action=leftajaxpart&channelid="+channelid;

 	pagination_scheduler_playlist(url,'schedulerplaylist');

 	}
	currentshedullarvideoid='';
}

function PlayChannelVideo(video_id)
{

	if(currentplayid!=0)
	{
		document.getElementById("playpause_"+currentplayid).src=spath+"images/Play_button.png";
		currentplayid=0;
	}

	getMovie("GetHitMusic").PlayChannelVideo(video_id)

}

function ChangeColor(col)
{
	var r = col.split(",")[0];
	var g = col.split(",")[1];
	var b = col.split(",")[2];
	//alert(r);
  	getMovie("GetHitMusic").ChangeColor(r,g,b); // Pass RGB
	//alert(r);
}
function getMovie(movieName)
{
  	if (navigator.appName.indexOf("Microsoft") != -1)
	{
		return window[movieName]
	}
	else
	{
		return document[movieName];
	}
}

function popupplayerwindow(ur,id)
{
	mywin  = window.open(ur+'main.php?do=playlist&action=popupplaylist&playlistid='+id,'console','width=700, height=600, location=1,status=1,scrollbars=1');

	if(mywin)
	  mywin.focus();
	  //mywin.document.title='Javascript Console...';
	//mywin.document.writeln('<h4>Javascript Log here..</h4>');
	//if(msg!=null)


}
function setrepetloop(url,type)
{
	if(type=='loop')
	{
		if(document.getElementById("loop").value==1)
		{	document.getElementById("loop").value=0;
			document.getElementById("loopimage").src = url+"/images/refresh_red.png";
		}
		else
		{
			document.getElementById("loop").value=1;
			document.getElementById("loopimage").src = url+"/images/refresh_pink.png";
		}

	}
	if(type=='repet')
	{
		if(document.getElementById("Repet").value==1)
		{
			document.getElementById("Repet").value=0;
			document.getElementById("repetimage").src = url+"/images/shuffle_red.png";
		}
		else
		{
			document.getElementById("Repet").value=1;
			document.getElementById("repetimage").src = url+"/images/shuffle_pink.png";
		}

	}
}
function checkmouse()
{
	if(document.getElementById("dragdroplist").style.cursor=="move")
	{

		document.getElementById("shov").value='t'
	}
}


function setdeley(t)
{
	 if(t=='out'){
	setTimeout('',10000)
	document.getElementById('shov').value='f'
	 }
	 if(t=='over')
	 {
		 if(document.getElementById("selectedid").value!='')
		 document.getElementById('shov').value='t'
	 }

}
function checkalreadypurchasealbumornot(userid,albumid)
{
	if(userid!='')
	{

	var conf = window.confirm("If you are already purchase this album you can download from you account otherwise you purchase this album for downloading");
	if(conf)
	{
		location.href = spath+"main.php?do=cart&action=cartview&id="+albumid+"&ptype=album&download=download";
	}
	}else
	{
		alert("Please login or create account before downloading");
		return false;
	}
}
function checkalreadypurchasealbumornot_forartist(userid,albumid)
{
	if(userid!='')
	{

	var conf = window.confirm("Please purchase album to add your playlist");
	if(conf)
	{

                //alert(spath+"main.php?do=cart&action=cartview&id="+albumid+"&ptype=album&download=download");

                location.href = "http://www.gethitmusic.com/main.php?do=cart&action=cartview&id="+albumid+"&ptype=album&download=download";


	}
	}else
	{
		alert("Please login for adding the into the playlist");
		return false;
	}
}
function selectgener(id)
{
	document.getElementById("dragdroplistinner").style.display='';
	document.getElementById("schedulerplaylist").style.display='none';
	divid = "dragdroplistinner";
	currentplayid=0;
	document.getElementById("genselect").value=1;

 	pagination_listing_player_genre(spath+"main.php?do=allvideo&action=viewgenreplaylist&selectedid="+id,divid);

}

var currentshedullarvideoid="";
function setcurrentshedulevideo(videoid)
{

	if(currentshedullarvideoid!="")
	{
		document.getElementById("schduler_id"+currentshedullarvideoid).className = "DragListing";
	}

 	document.getElementById("schduler_id"+videoid).className = "DragListing2";
 	currentshedullarvideoid = videoid;

}

function pagination_scheduler_playlist(url,divid)
{	var ajax = new GHM.AJAX();
	//alert(url)
  	ajax.callPage(url, mainCallback_scheduler_playlist, "GET",divid);
}
function mainCallback_scheduler_playlist(responseText,divid)
{

  	document.getElementById(divid).innerHTML  = responseText;
 	if(document.getElementById("YMusicRegion_T3_R2C1_R2")){
		carouselLoad();
	}

	if(responseText){
	videoid = document.getElementById("firstplayid").value;
	setcurrentshedulevideo(videoid)
	//currentshedullarvideoid='';
	}
}

function checkpurchaseural(id,type)
{ va = va[0].split("album");
	spath = va[0];

	var conf = window.confirm("Please Purchase this product before adding in the playlist");
				 if(conf)
				 {

					 window.location.href = spath+"main.php?do=cart&action=cartview&id="+id+"&ptype="+type;
				 }
}



function showaccesstypeofvideomusic(playid)
{

	if(document.getElementById("type0"+playid).value=='music')
	{
				 var imgValue = document.getElementById("imgpath0"+playid).value;

						var artistname = document.getElementById("artistname0"+playid).value;
						var genername = document.getElementById("genername0"+playid).value;
						var releaseedate = document.getElementById("releaseedate0"+playid).value;
						var albunmname = document.getElementById("albunmname0"+playid).value;
						var description = document.getElementById("description0"+playid).value;
						ShowArtistDetail(spath+imgValue,artistname,genername,releaseedate,albunmname,description)
	}
}

