	/**
	 * @author Created by: Shan
	 * @author Updated by: Shan
	 *
	 * Description: This JS is consists all the Ajax functions and VO's with regard to A1 page.
	 *
	 * (c) Copyright 2008, Scripps Networks Interactive.  All rights reserved.
	 * This software contains confidential information and trade secrets
	 * of Scripps Networks Interactive.  Use, disclosure, or reproduction is
	 * prohibited without the prior written consent of Scripps Networks Interactive.
	 *
	 */

/*		ValueObject Definitions Starts Here    */

// Channel Value Objects .....

function Channel(chid,caption,creationdate,siteicon,objectFullcaption, lockuserid, lockpassword, lockuseremail) 
{

//	Setters ....

    this._channelId = chid;
    this._channelCaption = caption;
    this._channelCreationDate = creationdate;
    this._siteIcon=siteicon;
   	this._objectFullcaption=objectFullcaption;
   	this._lockuserid=lockuserid;
   	this._lockpassword=lockpassword;
    this._lockuseremail = lockuseremail;
//  Getters ....

    this.getChannelId = function()
	  {
	    return this._channelId;
	  };
	  
	this.getChannelCaption = function()
	  {
	    return this._channelCaption;
	  };
	
	this.getChannelCreationDate = function()
	  {
	    return this._channelCreationDate;
	  };
	this.getSiteIcon = function()
	  {
	    return this._siteIcon;
	  };
	 this.getObjectFullCaption=function()
	 {
	 	return this._objectFullcaption;
	 } 
	 this.getLockuserid=function()
	 {
	 	return this._lockuserid;
	 } 
	 this.getLockpassword=function()
	 {
	 	return this._lockpassword;
	 } 
	 this.getLockuseremail=function()
	 {
	 	return this._lockuseremail;
	 } 
}



/* 		ValueObject Definitions Ends Here	*/

/*
* Global Variable Declarations starts Here ....
*/
	var channelObjectArray = new Array();
	var totalNoOfChannelsPage = 0;
	//var channelPageLen = 5;
	var channelPageLen = 10;
	var ie=document.all;
	
// 	global error constants
	 	 
	 var serverError = "You found an opportunity for improvement! Please try again later"
	 var connectionError = "There appears to be a connectivity problem. Please check your internet connection and try again."
	 
/*
* Global Variable Declarations Ends Here ....
*/


function Split_into_Array(input,seperator)
{
	var temp = new Array();
	while(input.indexOf(seperator)!=-1)
	{
		temp[temp.length] = input.substring(0,input.indexOf(seperator));
		input = input.substring(input.indexOf(seperator)+1,input.length);
	}
	temp[temp.length] = input;
	return temp;
}


	 
function searchProjects(loadPageNo)
{
	//alert("here");
	var sy=document.getElementById('start_yyyy').value;
	var sd=document.getElementById('start_dd').value;
	var sm=document.getElementById('start_mm').value;
	var em=document.getElementById('end_mm').value;
	var ed=document.getElementById('end_dd').value;
	var ey=document.getElementById('end_yyyy').value;
	var site=document.getElementById('site').value;
	var tags=document.getElementById('tags').value;
	var search_text=document.getElementById('search_text').value;
	var object_type=document.getElementById('sot').value;
	
	
	var assetscope=2;
	if(document.getElementById('assetscope'))
	{
		assetscope=document.getElementById('assetscope').value;
	}
	var sea_status=document.getElementById('Seastatusdrop').value;
	//receive_projects(sy,sd,sm,em,ed,ey,site,"asst",loadPageNo, tags, search_text, object_type);
	receive_projects(sy,sd,sm,em,ed,ey,site,assetscope,loadPageNo, tags, search_text, object_type,sea_status);
}

function searchWithinContainer()
{
	//==
	var sy=document.getElementById('start_yyyy').value;
	var sd=document.getElementById('start_dd').value;
	var sm=document.getElementById('start_mm').value;
	var em=document.getElementById('end_mm').value;
	var ed=document.getElementById('end_dd').value;
	var ey=document.getElementById('end_yyyy').value;
	var site=document.getElementById('site').value;
	var tags=document.getElementById('tags').value;
	var search_text=document.getElementById('search_text').value;
	var object_type=document.getElementById('sot').value;
	var assetscope=6;
	var sea_status=document.getElementById('Seastatusdrop').value;
	var channelId = document.getElementById("chSelId").value;
	var searchType=document.getElementById('searchType').value;
	//==
	var query_str =
	"start_yyyy="+sy+"&start_mm="+sm+"&start_dd="+sd+
	"&end_yyyy="+ey+"&end_mm="+em+"&end_dd="+ed+
	"&scope=6"+
	"&site="+site+
	//"&tags="+tags+
	"&search_text="+search_text+
	"&sot="+object_type+
	"&status="+sea_status+
	"&pageNumber="+1+
	"&chSelId="+channelId+
	"&searchType="+searchType;
	//"&sortBy="+sortBy;
	
	document.adminsearchbox.method="POST";
	document.adminsearchbox.action="searchProject_p2.do?"+query_str;
	document.adminsearchbox.submit();
}

function removeFilterProjects(loadPageNo)
{
	document.getElementById('start_yyyy').value = 2008;
	document.getElementById('start_dd').value = 1;
	document.getElementById('start_mm').value = 1;
	document.getElementById('end_mm').value = 12;
	document.getElementById('end_dd').value = 31;
	document.getElementById('end_yyyy').value = 2009;
	var sy=document.getElementById('start_yyyy').value;
	var sd=document.getElementById('start_dd').value;
	var sm=document.getElementById('start_mm').value;
	var em=document.getElementById('end_mm').value;
	var ed=document.getElementById('end_dd').value;
	var ey=document.getElementById('end_yyyy').value;
	document.getElementById('site').value=-1;
	document.getElementById('tags').value="";
	document.getElementById('search_text').value="";
	var object_type=document.getElementById('sot').value;	
	receive_projects(sy,sd,sm,em,ed,ey,"-1","asst",loadPageNo, "", "", object_type);
}

var GlobalId_Array = new Array();

function loadLibraryOnKeyUp(e)
{
	var searchLibrarary = document.getElementById('searchLibrary_txt').value;
	var nn6=document.getElementById&&!document.all
	var fobj = nn6 ? e.target : event.srcElement
	var KeyID = (window.event) ? event.keyCode : e.keyCode
	 
	if(KeyID==13)
	{
		if(searchLibrarary!="")
			loadLibrary()
	}	
}	

function loadLibrary()
{
	var fromDate="";
	var toDate = "";
	var parId = document.getElementById('objectId').value;
	var objType = "2";
	var assetType =  document.getElementById('assettype_sel').value;
	var channelsite =  document.getElementById('channelSite_sel').value;
	var producer = document.getElementById('a1a_producer_sel').value;
	var searchLibrarary = document.getElementById('searchLibrary_txt').value;
	var searchTag = document.getElementById('searchTags_txt').value;
	var uploadFromDay = document.getElementById('upload_from_day_sel').value;
	var uploadFromMonth = document.getElementById('upload_from_month_sel').value;
	var uploadFromYear = document.getElementById('upload_from_year_sel').value;

	var uploadToDay = document.getElementById('upload_to_day_sel').value;
	var uploadToMonth = document.getElementById('upload_to_month_sel').value;
	var uploadToYear = document.getElementById('upload_to_year_sel').value;
	
	var pagNumber = "1";//document.getElementById('librarayPageNum').value;
	
	var copyright = "0"; //document.getElementById('copyright_sel').value;	
	var sortBy =  "0"; //document.getElementById('sortby_sel').value;
	
	var currentTime = new Date();
    var hours = currentTime.getHours();
    var minutes = currentTime.getMinutes();
	var seconds = currentTime.getSeconds();
	
	if(pagNumber==""){
		pagNumber="1";
	}
	fromDate = uploadFromYear+"-"+uploadFromMonth+"-"+uploadFromDay;//+" "+hours+":"+minutes+":"+seconds;
	toDate = uploadToYear+"-"+uploadToMonth+"-"+uploadToDay;//+" "+hours+":"+minutes+":"+seconds;
	
	/*
	if(assetType=="0" && channelsite=="-1"
		&& searchLibrarary=="" && searchTag==""){
		fromDate = "null";
		toDate = "null";
	}
	*/
	
	//alert(parId+","+objType+","+pagNumber+","+copyright+","+assetType+","+sortBy+","+searchLibrarary);	
	//receive_library(parId,objType,'1','1','1','1','');
	receive_library(parId,objType,pagNumber,copyright,assetType,sortBy,searchLibrarary,channelsite,fromDate,toDate,searchTag,producer);
}	

function loadLibraryWithPage()
{
	var fromDate="";
	var toDate = "";
	var parId = document.getElementById('objectId').value;
	var objType = "2";
	var assetType =  document.getElementById('assettype_sel').value;
	var channelsite =  document.getElementById('channelSite_sel').value;
	var producer = document.getElementById('a1a_producer_sel').value;
	var searchLibrarary = document.getElementById('searchLibrary_txt').value;
	var searchTag = document.getElementById('searchTags_txt').value;
	var uploadFromDay = document.getElementById('upload_from_day_sel').value;
	var uploadFromMonth = document.getElementById('upload_from_month_sel').value;
	var uploadFromYear = document.getElementById('upload_from_year_sel').value;

	var uploadToDay = document.getElementById('upload_to_day_sel').value;
	var uploadToMonth = document.getElementById('upload_to_month_sel').value;
	var uploadToYear = document.getElementById('upload_to_year_sel').value;
	
	var pagNumber = document.getElementById('librarayPageNum').value;
	
	var copyright = "0"; //document.getElementById('copyright_sel').value;	
	var sortBy =  "0"; //document.getElementById('sortby_sel').value;
	
	var currentTime = new Date();
    var hours = currentTime.getHours();
    var minutes = currentTime.getMinutes();
	var seconds = currentTime.getSeconds();
	
	if(pagNumber==""){
		pagNumber="1";
	}
	fromDate = uploadFromYear+"-"+uploadFromMonth+"-"+uploadFromDay;//+" "+hours+":"+minutes+":"+seconds;
	toDate = uploadToYear+"-"+uploadToMonth+"-"+uploadToDay;//+" "+hours+":"+minutes+":"+seconds;
	
	/*
	if(assetType=="0" && channelsite=="-1"
		&& searchLibrarary=="" && searchTag==""){
		fromDate = "null";
		toDate = "null";
	}
	*/
	//alert(parId+","+objType+","+pagNumber+","+copyright+","+assetType+","+sortBy+","+searchLibrarary);	
	//receive_library(parId,objType,'1','1','1','1','');
	receive_library(parId,objType,pagNumber,copyright,assetType,sortBy,searchLibrarary,channelsite,fromDate,toDate,searchTag,producer);
}	

function closeLibrary()
{
	GlobalId_Array = new Array();
}

function receive_library(parentId,objectType,pageNumber,copyright,assetType,sortBy,searchLibrarary,channelsite,fromDate,toDate,searchTag,producer)
{ 
 var request=ie?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();
 //var url=base_Url+"/a1aCollection_p2.do?ajax=Ajax";
 var url=base_Url+"/a1aCollectionAddLibrary_p2.do?ajax=Ajax&parentId="+parentId+"&objectType="+objectType+"&pageNumber="+pageNumber+"&copyright="+copyright+"&assetType="+assetType+"&sortBy="+sortBy+"&searchlibrary="+searchLibrarary;
 url += "&site="+channelsite+"&fromdate="+fromDate+"&todate="+toDate+"&searchtag="+searchTag+"&producer="+producer;
 request.onreadystatechange=function()
 {
  if(request.readyState==4)
  {
   if(request.status==200)
   {
   		document.getElementById('tty').innerHTML = "";
		var objectIds = request.responseXML.getElementsByTagName('objectId');
		var objectThumbPath = request.responseXML.getElementsByTagName('objectClipThumb');
		var objectCaption = request.responseXML.getElementsByTagName('objectCaption');
		var objectCurrentPage=request.responseXML.getElementsByTagName('currentPage');
		var objectTotalPages=request.responseXML.getElementsByTagName('totalPages');
		var objectTotalItems=request.responseXML.getElementsByTagName('totalItems');	
		var objectStartIndex=request.responseXML.getElementsByTagName('startIndex');
		var objectEndIndex=request.responseXML.getElementsByTagName('endIndex');
		
		var currentPage=0;
		var totalPages=0;
		var totalItems =0;
		var startIndex=0;
		var endIndex=0;
		
		var imagePath =  base_Url+"/skins/main/images/account/buttons/smallAdd.gif";
		var inner_contents = "<div>";
		
		if(objectIds.length==0)
			inner_contents += "<p class=\"copy09_blue_noul\" align=\"center\" style=\"padding: 5px;\">No Results Found</p>";
		
   		for(var j=0;j<objectIds.length;j++)
   		{
   			if(j==0){
   				currentPage = objectCurrentPage.item(j).firstChild.nodeValue;
				totalPages=objectTotalPages.item(j).firstChild.nodeValue;
				totalItems=objectTotalItems.item(j).firstChild.nodeValue;
				startIndex=objectStartIndex.item(j).firstChild.nodeValue;
				endIndex=objectEndIndex.item(j).firstChild.nodeValue;
   			}
   			var objTextCaption = objectCaption.item(j).firstChild.nodeValue!='N/A'?objectCaption.item(j).firstChild.nodeValue:"&nbsp;";
   			var tempObjectId =  "objImgId_"+objectIds.item(j).firstChild.nodeValue;
   			var tempThumbObjectId =  "objThuId_"+objectIds.item(j).firstChild.nodeValue;
   			var tempDivObjectId =  "divAddRe_"+objectIds.item(j).firstChild.nodeValue;
   			inner_contents += "<div style=\"width:23%; float: left; padding-right: 2px; margin-bottom: 10px;\">";
   				inner_contents += "<div id=\""+tempDivObjectId+"\" class=\"divAdd\" style=\"position: relative; top: 0; left: 0;\">";
   					inner_contents += "<div style=\"padding: 3px;\">";
   						inner_contents += "<img id=\""+tempThumbObjectId+"\" onClick=\"addRemoveLibrary(this)\" src=\""+objectThumbPath.item(j).firstChild.nodeValue+"\" width=\"150px\" height=\"150px\" />";
   					inner_contents += "</div>";
   					inner_contents += "<div align=\"left\" style=\"position:relative; padding: 0px 0px 2px 3px;\">";
   						inner_contents += "<div style=\"position:absolute; top:0; *left:-25px;\">";
   							inner_contents += "<input id=\""+tempObjectId+"\" type=\"checkbox\" onClick=\"addRemoveLibrary(this)\" />";
   						inner_contents += "</div>";
   						inner_contents += "<div style=\"position:relative; margin: 0px 0px 0px 25px;\"><p>"+objTextCaption+"</p></div>";
   					inner_contents += "</div>";
   				inner_contents += "</div>";
   			inner_contents += "</div>";
   		}	
   		
		
		
		inner_contents += "</div>";
   		
   		document.getElementById('addfromlibrary_records').innerHTML = 'Displaying '+startIndex+' to '+endIndex+' of '+totalItems+' matches.';
   		
		// Regenerate the pages List ....
   		
   		//var pagesHtml = "Page&nbsp;<select onchange=\"loadLibrary()\" id='addFromLibraryPages' style='vertical-align: middle;' class='copy09_blue_noul'>"
   		
   		var pagesHtml = "";
		
		for(j=1;j<=totalPages;j++){
			if(currentPage==j)
				pagesHtml += "<option value='"+j+"' selected>"+j+"</option>";
			else
				pagesHtml += "<option value='"+j+"'>"+j+"</option>";
		}
			
		pagesHtml += "</select>";
		
		//Append the Html into the pagination container ....
		
   		document.getElementById('librarayPageNum').innerHTML = pagesHtml;
   		
   		document.getElementById('addFromLibMaxPage').innerHTML = totalPages;
   		
   		document.getElementById('tty').innerHTML = inner_contents;
   }
   else if(request.status==500)
    alert(serverError);
   else
    alert(connectionError);
  }
 }

 request.open("POST",url,true);
 request.setRequestHeader("content-type","application/x-www-form-urlencoded");
 request.send(''); 
}

function addRemoveLibrary(curObj)
{
	var imagePath =  base_Url+"/skins/main/images/account/buttons/";
	var tmpId = curObj.id;
	var selId = tmpId.substring(9);
	var checkBoxStatus = document.getElementById('objImgId_'+selId).checked;

	if(tmpId .indexOf('objThuId')!=-1)
	{
		if(checkBoxStatus){
			document.getElementById('objImgId_'+selId).checked = false;
			document.getElementById('divAddRe_'+selId).className = "divAdd";		
		}
		else{
			document.getElementById('objImgId_'+selId).checked = true;
			document.getElementById('divAddRe_'+selId).className = "divRemove";
		}
	}	
	else{
		if(checkBoxStatus){
			document.getElementById('divAddRe_'+selId).className = "divRemove";		
		}
		else{
			document.getElementById('divAddRe_'+selId).className = "divAdd";
		}
	}	
	/*
	var imageSourcePath = document.getElementById('objImgId_'+selId).src;
	if(imageSourcePath.indexOf('Add')!=-1){
		document.getElementById('objImgId_'+selId).src = imagePath+"smallRemove.gif";
		document.getElementById('divAddRe_'+selId).className = "divRemove";
	}
	else{
		document.getElementById('objImgId_'+selId).src = imagePath+"smallAdd.gif";
		document.getElementById('divAddRe_'+selId).className = "divAdd";
	}
	*/
	addLibraryitem(selId);
}

function addLibraryitem(obj)
{
	var bool = true;
	for(i=0;i<GlobalId_Array.length;i++)
	{
		if(obj==GlobalId_Array[i])
		{
			GlobalId_Array.splice(i,1);
			bool = false;
		}
	}	
	
	if(bool)
	{
		GlobalId_Array[GlobalId_Array.length] =obj;
	}		
	//alert('GlobalId_Array :'+GlobalId_Array);
}


function copyFromLibrary()
{
	var parId = document.getElementById('objectId').value;
	
	if(GlobalId_Array.length>0)
	{
		//var url = "/copyobjects.do?ocl="+GlobalId_Array+"&tctnr="+parId+"&addfromlibrary=true";
		var url = base_Url+"/copyobjects.do?ocl="+GlobalId_Array+"&tctnr="+parId+"&addfromlibrary=true&loc_return="+escape(document.location+"");
		GlobalId_Array = new Array();
		document.getElementById('tty').innerHTML = "";
		//simplePost(url,"reloadBodyWithPagination()");
		window.location.href = url;
		
	}	
}


function receive_upload_id(userid)
{ 
	//alert(document.getElementById('objectId').value);
	var url = "/loadXupload_p2.do?parentId="+document.getElementById('objectId').value;
	if( document.getElementById('siteId') )
		url += "&siteId=" + document.getElementById('siteId').value;
	
	if(document.getElementById('seqnumber'))
		url += "&seqnumber="+document.getElementById('seqnumber').value;	
		//alert(url);
		
	if( document.getElementById('pv_flag'))
		url += "&pv_flag="+document.getElementById('pv_flag').value;
	
	if(userid!="" && userid!=undefined && userid!="undefined")//This code is added to handle uploadedby field in upload window Box
		url += "&userId="+userid;
	
	simplePost(url,"renderUploader(common_request)");
}
function renderUploader(request)
{	
	document.getElementById('xupload').innerHTML = request.responseText;	
}

function sortBy(sortBy_Val,loadPageNo,asset)
{
	var url = "/sortchannel.do?sortBy="+sortBy_Val;
	simplePost(url,"displayChannelList(common_request,'"+loadPageNo+"','"+asset+"')");
}
/*
* Copy move filter and search part starts here ....
*/
var cpmvchannelObjectArray = new Array();
var cpmv_objIds ;
var cpmv_captions ;
var cpmv_dates ;
var cpmv_siteicon;
var totalItems;
   		
function copyormove(whateventitis)
{
	var prefix = "";
	if(whateventitis=='copy')
		prefix = "cp_";
	else
		prefix = "mv_";
	var sy=document.getElementById(prefix+'start_yyyy').value;
	var sd=document.getElementById(prefix+'start_dd').value;
	var sm=document.getElementById(prefix+'start_mm').value;
	var em=document.getElementById(prefix+'end_mm').value;
	var ed=document.getElementById(prefix+'end_dd').value;
	var ey=document.getElementById(prefix+'end_yyyy').value;
	var search_text=document.getElementById(prefix+'search_text').value;
	
	if(whateventitis=='copy')
		copy_move_receive_projects(sy,sd,sm,em,ed,ey,"-1","asst","1", "", search_text,'channel_container_cp','copy_channelpaginationcontainer','copy')
	else
		copy_move_receive_projects(sy,sd,sm,em,ed,ey,"-1","asst","1", "", search_text,'channel_container_mv','move_channelpaginationcontainer','move')
}

function cpmv_removeFilterProjects(whateventitis,position)
{
	var prefix = "";
	if(whateventitis=='copy')
		prefix = "cp_";
	else
		prefix = "mv_";
	document.getElementById(prefix+'start_yyyy').value = 2008;
	document.getElementById(prefix+'start_dd').value = 1;
	document.getElementById(prefix+'start_mm').value = 1;
	document.getElementById(prefix+'end_mm').value = 12;
	document.getElementById(prefix+'end_dd').value = 31;
	document.getElementById(prefix+'end_yyyy').value = 2009;
	var sy=document.getElementById(prefix+'start_yyyy').value;
	var sd=document.getElementById(prefix+'start_dd').value;
	var sm=document.getElementById(prefix+'start_mm').value;
	var em=document.getElementById(prefix+'end_mm').value;
	var ed=document.getElementById(prefix+'end_dd').value;
	var ey=document.getElementById(prefix+'end_yyyy').value;
	document.getElementById(prefix+'search_text').value="";	
	
		
	if(whateventitis=='copy')
		copy_move_receive_projects(sy,sd,sm,em,ed,ey,"-1","asst","1", "", "",'channel_container_cp'+position,'copy_channelpaginationcontainer'+position,'copy')
	else
		copy_move_receive_projects(sy,sd,sm,em,ed,ey,"-1","asst","1", "", "",'channel_container_mv'+position,'move_channelpaginationcontainer'+position,'move')
}

function copy_move_receive_projects(syear,sdate,smonth,emonth,edate,eyear,siteId,asset,loadPageNo, tags, search_text,container_name,pagi_container,action)
 { 
 	/*
	document.getElementById('loading_image').style.left = findPosX(document.getElementById(container_name))+100;
	document.getElementById('loading_image').style.top = findPosY(document.getElementById(container_name));
	document.getElementById('loading_image').style.display = "block";
	*/
	showLoading(container_name);
 	cpmvchannelObjectArray = new Array();	 	
    //var url= "/searchProject_p2.do?ajax=Ajax&start_yyyy="+syear+"&start_mm="+smonth+"&start_dd="+sdate+"&end_yyyy="+eyear+"&end_mm="+emonth+"&end_dd="+edate+"&assetType="+asset+"&site="+siteId+"&tags="+tags+"&search_text="+search_text+"&copyormove=yes&scope=2";
    var url= "/searchProject_CM_p2.do?ajax=Ajax&start_yyyy="+syear+"&start_mm="+smonth+"&start_dd="+sdate+"&end_yyyy="+eyear+"&end_mm="+emonth+"&end_dd="+edate+"&assetType="+asset+"&site="+siteId+"&tags="+tags+"&search_text="+search_text+"&scope=4"+"&pageNumber="+loadPageNo;
   	if(getParameter("listIndex")!=null && getParameter("listIndex")!="null")
   	  url += "&listIndex="+getParameter("listIndex")
   	//var a = prompt("test",url);
 	//alert( url );
    simplePost(url,"cpmv_displayChannelList(common_request,"+loadPageNo+",'"+container_name+"','"+pagi_container+"','"+action+"');");
}

function cpmv_displayChannelList(request,loadPageNo,container_name,pagi_container,action)
{	
		if(isNaN(loadPageNo))
			loadPageNo = 1;
		//try{
		//alert(request.responseText);
		totalItems = request.responseXML.getElementsByTagName('totalItems')[0].firstChild.nodeValue;
		cpmv_objIds = request.responseXML.getElementsByTagName('objectId');
   		cpmv_captions = request.responseXML.getElementsByTagName('objectCaption');
   		cpmv_dates = request.responseXML.getElementsByTagName('objectDate');
   		cpmv_siteicon=request.responseXML.getElementsByTagName('siteIconUrl');
   		
   		if(cpmv_objIds.length==0)
   		{
   			document.getElementById('loading_image').style.display = "none";
   			document.getElementById(container_name).innerHTML = "<p class=\"copy09_blue_noul\" align=\"center\" style=\"padding: 5px;\">No Results Found</p>";
   		}
   		//calculate total no of pages for channels pagination ....
   	
   		//totalNoOfChannelsPage = Math.ceil(cpmv_objIds.length/cpmv_channelPageLen);
   		totalNoOfChannelsPage = Math.ceil(totalItems/cpmv_channelPageLen);  

   		// Regenerate the pages List ....
   	
   		var pagesHtml = "Page&nbsp;<select onchange=\"cpmv_renderChannels(this.value,'"+container_name+"','"+action+"')\" id='channelPagescpmv' style='vertical-align: middle;' class='copy09_blue_noul'>"
   		
   		var pagesHtml = "Page&nbsp;<select onchange=\"cpmv_renderChannelsPage(this.value,'"+container_name+"','"+pagi_container+"')\" id='channelPagescpmv' style='vertical-align: middle;' class='copy09_blue_noul'>"
		if(pagi_container=='copy_channelpaginationcontainertop')
			pagesHtml = "Page&nbsp;<select onchange=\"cpmv_renderChannelsPage(this.value,'"+container_name+"','"+pagi_container+"')\" id='channelPagescpmv' style='vertical-align: middle;' class='copy09_blue_noul'>"
		if(pagi_container=='copy_channelpaginationcontainerbottom')
			pagesHtml = "Page&nbsp;<select onchange=\"cpmv_renderChannelsPage(this.value,'"+container_name+"','"+pagi_container+"')\" id='channelPagescpmv_bottom' style='vertical-align: middle;' class='copy09_blue_noul'>"
		
		if(pagi_container=='move_channelpaginationcontainertop')
			pagesHtml = "Page&nbsp;<select onchange=\"cpmv_renderChannelsPage(this.value,'"+container_name+"','"+pagi_container+"')\" id='movchannelPagescpmv' style='vertical-align: middle;' class='copy09_blue_noul'>"
		if(pagi_container=='move_channelpaginationcontainerbottom')
			pagesHtml = "Page&nbsp;<select onchange=\"cpmv_renderChannelsPage(this.value,'"+container_name+"','"+pagi_container+"')\" id='movchannelPagescpmv_bottom' style='vertical-align: middle;' class='copy09_blue_noul'>"
			
		for(j=1;j<=totalNoOfChannelsPage;j++)
			pagesHtml += "<option value='"+j+"'>"+j+"</option>";
			
		pagesHtml += "</select> of "+totalNoOfChannelsPage;
		
		//Append the Html into the pagination container ....
		
		document.getElementById(pagi_container).innerHTML = pagesHtml;
		
		//Append Channel objects in Channel Array Objects ....	

   		for(i=0;i<cpmv_objIds.length;i++)
   		 {
   		 	cpmvchannelObjectArray[i] = new Channel(cpmv_objIds.item(i).firstChild.nodeValue,cpmv_captions.item(i).firstChild.nodeValue,cpmv_dates.item(i).firstChild.nodeValue,cpmv_siteicon.item(i).firstChild.nodeValue);
   		 }
   		
   		if(cpmv_objIds.length>0)
   		{
   			//cpmv_renderChannels(loadPageNo,container_name,action);
   			if(pagi_container=='copy_channelpaginationcontainertop')
   				document.getElementById('channelPagescpmv').value = loadPageNo;
   			if(pagi_container=='copy_channelpaginationcontainerbottom')
   				document.getElementById('channelPagescpmv_bottom').value = loadPageNo;
   				
   			if(pagi_container=='move_channelpaginationcontainertop')
   				document.getElementById('movchannelPagescpmv').value = loadPageNo;
   			if(pagi_container=='move_channelpaginationcontainerbottom')
   				document.getElementById('movchannelPagescpmv_bottom').value = loadPageNo;
   				
   			var inner_Text = "<table cellpadding='0' cellspacing='0' border='0'>";

   		 for(i=0;i<cpmv_objIds.length;i++)
   		 {
   		 inner_Text += "<tr valign=\"center\">"+
      						"<td style=\"padding: 3px;\"><a href=\"javscript:void(0);\"><img src=\""+cpmvchannelObjectArray[i].getSiteIcon()+"\" border=\"0\"></a></td>"+
      						"<td style=\"padding: 3px;\" width=\"100%\"><p><a href=\"#\" onClick=\"moveSelected("+cpmvchannelObjectArray[i].getChannelId()+",'"+action+"')\">"+cpmvchannelObjectArray[i].getChannelCaption()+"</a></p></td>"+
  					   "</tr>";
	 	
   		 }
   		 inner_Text += "</table>";
   		 
  		 document.getElementById(container_name).innerHTML = inner_Text;
  		 
  		 document.getElementById('loading_image').style.display = "none";
   		} 
   		
   		//}catch(e){alert(e.message);}
}
var cpmv_channelPageLen = 10;
function cpmv_renderChannelsPage(pageNo,container_name,pagi_container){

var prefix = "";
	
	document.getElementById(prefix+'start_yyyy').value = 2008;
	document.getElementById(prefix+'start_dd').value = 1;
	document.getElementById(prefix+'start_mm').value = 1;
	document.getElementById(prefix+'end_mm').value = 12;
	document.getElementById(prefix+'end_dd').value = 31;
	document.getElementById(prefix+'end_yyyy').value = 2009;
	var sy=document.getElementById(prefix+'start_yyyy').value;
	var sd=document.getElementById(prefix+'start_dd').value;
	var sm=document.getElementById(prefix+'start_mm').value;
	var em=document.getElementById(prefix+'end_mm').value;
	var ed=document.getElementById(prefix+'end_dd').value;
	var ey=document.getElementById(prefix+'end_yyyy').value;
	document.getElementById(prefix+'search_text').value="";	
	
		//copy_move_receive_projects(sy,sd,sm,em,ed,ey,"-1","asst",pageNo, "", "",'channel_container_cp'+position,'copy_channelpaginationcontainer'+position,'copy')
		copy_move_receive_projects(sy,sd,sm,em,ed,ey,"-1","asst",pageNo, "", "",container_name,pagi_container,'copy')
}
function cpmv_renderChannels(pageNo,container_name,action)
{
	
	var bot_pagin = "<tr><td><p class='copy09_blue-noul'>";

	document.getElementById('channelPagescpmv').value = pageNo;
	var from = (pageNo-1) * cpmv_channelPageLen;
	var upto = pageNo * cpmv_channelPageLen;
	var bothTrue = false;

	
	/*if(from>1){
		bothTrue = true;
		bot_pagin += "<a href=\"javascript:cpmv_renderChannels("+(parseInt(pageNo)-1)+",'"+container_name+"','"+action+"')\">Previous</a>"
	}*/
	if(upto > (cpmvchannelObjectArray.length-1))
	{
		upto = cpmvchannelObjectArray.length;
		if(from>1)
		{			
			bot_pagin += "<a href=\"javascript:cpmv_renderChannels("+(parseInt(pageNo)-1)+",'"+container_name+"','"+action+"')\">Previous</a>"
		}	
	}else{
		if(bothTrue)
			bot_pagin += " | ";
		bot_pagin += "<a href=\"javascript:cpmv_renderChannels("+(parseInt(pageNo)+1)+",'"+container_name+"','"+action+"')\">Next</a>"	
	}
	
	bot_pagin += "</td></tr>";
	
	var inner_Text = "<table cellpadding='0' cellspacing='0' border='0'>";

   		 for(i=from;i<upto;i++)
   		 {
   		 inner_Text += "<tr valign=\"center\">"+
      						"<td style=\"padding: 3px;\"><a href=\"javscript:void(0);\"><img src=\""+cpmvchannelObjectArray[i].getSiteIcon()+"\" border=\"0\"></a></td>"+
      						"<td style=\"padding: 3px;\" width=\"100%\"><p><a href=\"#\" onClick=\"moveSelected("+cpmvchannelObjectArray[i].getChannelId()+",'"+action+"')\">"+cpmvchannelObjectArray[i].getChannelCaption()+"</a></p></td>"+
  					   "</tr>";
	 	
   		 }
   		 inner_Text += "</table>";
   		 
  		 document.getElementById(container_name).innerHTML = inner_Text;
  		 
  		 document.getElementById('loading_image').style.display = "none";
}


function receive_projects(syear,sdate,smonth,emonth,edate,eyear,siteId,asset,loadPageNo, tags, search_text, object_type,sea_status)
 { 
 	var searchType=document.getElementById('searchType').value;
    var chSelId=document.getElementById('chSelId').value;
    var sortBy=document.getElementById('sort_by_channel').value;
	//showLoading('channel_container');
	showLoading('wholecontainer');	
    var url= "/asynchronussearchProject_p2.do?start_yyyy="+syear+"&start_mm="+smonth+"&start_dd="+sdate+"&end_yyyy="+eyear+"&end_mm="+emonth+"&end_dd="+edate+"&scope="+asset+"&site="+siteId+"&tags="+tags+"&search_text="+search_text+"&sot="+object_type+"&status="+sea_status+"&pageNumber="+loadPageNo+"&chSelId="+chSelId+"&searchType="+searchType+"&sortBy="+sortBy;
   if(!newChannel)
   {
   	simplePost(url,"afterAjaxSearch(common_request)");//afterAjaxSearch is in cmsasset.js
   }else
   {
   	simplePost(url,"documenturlLoad()");
   }
}

function documenturlLoad()
{
	document.location = base_Url+"/loadProjectChildren.do?pId="+maxChId;
	
}

//NO LONGER USE-IT IS CHANGED INTO JSP

/*
* Copy move filter and search part ends here ....
*/
/*function receive_projects(syear,sdate,smonth,emonth,edate,eyear,siteId,asset,loadPageNo, tags, search_text, object_type,sea_status)
 { 
 
 	/*
	document.getElementById('loading_image').style.left = findPosX(document.getElementById('channel_container'))+100;
	document.getElementById('loading_image').style.top = findPosY(document.getElementById('channel_container'));
	document.getElementById('loading_image').style.display = "block";
	*/
	/*showLoading('channel_container');
 	channelObjectArray = new Array();	 	
    var url= "/searchProject_p2.do?ajax=Ajax&start_yyyy="+syear+"&start_mm="+smonth+"&start_dd="+sdate+"&end_yyyy="+eyear+"&end_mm="+emonth+"&end_dd="+edate+"&scope="+asset+"&site="+siteId+"&tags="+tags+"&search_text="+search_text+"&sot="+object_type+"&status="+sea_status;
   	if(getParameter("listIndex")!=null && getParameter("listIndex")!="null")
   	  url += "&listIndex="+getParameter("listIndex")
	//alert("url :"+url);
    simplePost(url,"sortBy('"+document.getElementById('sort_by_channel').value+"','"+loadPageNo+"','"+asset+"');");
    //simplePost(url,"displayChannelList(common_request,'"+loadPageNo+"')");
}

/*function displayChannelList(request,loadPageNo,asset)
{
		//var name=prompt("list",request.responseText);
		
		if(isNaN(loadPageNo))
			loadPageNo = 1;
		try{
		
		//alert(request.responseText);
		displayOff('leftPagDiv');
		if(request.responseXML.getElementsByTagName('objectId'));
			objIds=request.responseXML.getElementsByTagName('objectId');
		if(request.responseXML.getElementsByTagName('objectCaption'));
			captions=request.responseXML.getElementsByTagName('objectCaption');
		if(request.responseXML.getElementsByTagName('objectDate'));
			dates=request.responseXML.getElementsByTagName('objectDate');
   		if(request.responseXML.getElementsByTagName('siteIconUrl'));
			siteicon=request.responseXML.getElementsByTagName('siteIconUrl');
		if(request.responseXML.getElementsByTagName('objectFullCaption'));
			objectFullcaption=request.responseXML.getElementsByTagName('objectFullCaption');
		if(request.responseXML.getElementsByTagName('lockuserid'));
			lockuserid=request.responseXML.getElementsByTagName('lockuserid');
		if(request.responseXML.getElementsByTagName('lockpassword'));
			lockpassword=request.responseXML.getElementsByTagName('lockpassword');
		if(request.responseXML.getElementsByTagName('lockuseremail'));
			lockuseremail=request.responseXML.getElementsByTagName('lockuseremail');
		
		
   		if(objIds.length==0)
   		{
   			//alert("objIds.length :"+objIds.length);
   			document.getElementById('loading_image').style.display = "none";
   			document.getElementById('channel_container').innerHTML = "<p class=\"copy09_blue_noul\" align=\"center\" style=\"padding: 5px;\">No Results Found</p>";
   		}
   		//calculate total no of pages for channels pagination ....
   		
   		totalNoOfChannelsPage = Math.ceil(objIds.length/channelPageLen); 
   		
   		// Regenerate the pages List ....
   		
   		var pagesHtml = "Page&nbsp;<select onchange=\"renderChannels(this.value)\" id='channelPages' style='vertical-align: middle;' class='inputelement'>"
		
		for(j=1;j<=totalNoOfChannelsPage;j++)
			pagesHtml += "<option value='"+j+"'>"+j+"</option>";
			
		pagesHtml += "</select> of "+totalNoOfChannelsPage;
		
		//Append the Html into the pagination container ....
		
		document.getElementById('channelpaginationcontainer').innerHTML = pagesHtml;
		
		//Append Channel objects in Channel Array Objects ....	
   		
   		for(i=0;i<objIds.length;i++)
   		 {
   		 	channelObjectArray[i] = new Channel(objIds.item(i).firstChild.nodeValue,captions.item(i).firstChild.nodeValue,dates.item(i).firstChild.nodeValue,siteicon.item(i).firstChild.nodeValue,objectFullcaption.item(i).firstChild.nodeValue, lockuserid.item(i).firstChild.nodeValue, lockpassword.item(i).firstChild.nodeValue, lockuseremail.item(i).firstChild.nodeValue);
   		 }
   		
   		if(objIds.length>0)
   		{
   			renderChannels(loadPageNo,asset);
   		} 
   		else{
   			document.getElementById('channel_prev').style.visibility = "hidden";
   			document.getElementById('channel_nxt').style.visibility = "hidden";
   		}
   		}catch(e)
   		{
   			if(asset==2)
  		 	{
  		 		document.getElementById('loading_image').style.display = "none";
   				document.getElementById('channel_container').innerHTML = "<p class=\"copy09_blue_noul\" align=\"center\" style=\"padding: 5px;\">No Results Found</p>";
  		 		asset2();
  			}else if(asset==3)
  		 	{
  		 		document.getElementById('loading_image').style.display = "none";
   				document.getElementById('channel_container').innerHTML = "<p class=\"copy09_blue_noul\" align=\"center\" style=\"padding: 5px;\">No Results Found</p>";
  		 		asset3();
				
  			}
   		}
}
*/
/*function asset3()
{
	document.getElementById('rail_nav_1').style.display="block";
	document.getElementById('rail_nav_2').style.display="none";
	document.getElementById('createchannel').style.display="none";
	document.getElementById('cmsVisibility').href="javascript: cmsnavigation3();"
	document.getElementById('channelVisibility').href="javascript: channelnavigation3();"
}
function asset2()
{
	document.getElementById('rail_nav_2').style.display="block";
	document.getElementById('rail_nav_1').style.display="none";
	document.getElementById('createchannel').style.display="block";
	document.getElementById('cmsVisibility').href="javascript: cmsnavigation2();"
	document.getElementById('channelVisibility').href="javascript: channelnavigation2();"
}
/*function channelnavigation2()
{
		displayOn('rail_nav_2');
		displayOn('p2_rail');
		displayOff('rail_nav_1');
		displayOff('navigation_container');
		document.getElementById('assetscope').value=2
		//document.getElementById('assetscope').text='For P2 Channels';
		javascript:reloadCombo(document.getElementById('assetscope'));
}
/*function cmsnavigation2()
{
		/*displayOn('rail_nav_1'); 
		displayOff('rail_nav_2');
		displayOff('p2_rail');
		displayOn('navigation_container');*/
		/*document.getElementById('assetscope').value=3
		//document.getElementById('assetscope').text='For CMS Assets';
		javascript:reloadCombo(document.getElementById('assetscope'));
		document.getElementById("deletechannel").innerHTML='Delete';
		document.getElementById("renamechannel").innerHTML='Rename';		
		cmssearchProjects(1);
}*/
/*function channelnavigation3()
{
		/*displayOn('rail_nav_2');
		displayOff('p2_rail');
		displayOff('rail_nav_1');
		displayOn('navigation_container');*/
		/*document.getElementById('assetscope').value=2
		//document.getElementById('assetscope').text='For P2 Channels';
		document.getElementById("deletechannel").innerHTML='Delete';
		document.getElementById("renamechannel").innerHTML='Rename';
		javascript:reloadCombo(document.getElementById('assetscope'));
		searchProjects(1);
}*/
/*function cmsnavigation3()
{
		displayOn('rail_nav_1'); 
		displayOff('rail_nav_2');
		displayOn('p2_rail');
		displayOff('navigation_container');
		document.getElementById('assetscope').value=3
		//document.getElementById('assetscope').text='For CMS Assets';
		javascript:reloadCombo(document.getElementById('assetscope'));
}
*/


function cmsnavigation()
{		
		var scope = document.getElementById('assetscope').value;
		if(scope == 4)
		{
			document.getElementById('assetscope').value=5;
			document.getElementById('scope_id').value=5;
			javascript:ChangeCombo(document.getElementById('scope_id'));
		}
		if(scope == 2)
		{
			document.getElementById('assetscope').value=3;
		}
		
		cmssearchProjects(1);
}
function channelnavigation()
{
	var scope = document.getElementById('assetscope').value;
	if(scope == 5)
	{
		document.getElementById('assetscope').value=4;
		document.getElementById('scope_id').value=4;
		javascript:ChangeCombo(document.getElementById('scope_id'));
	}
	
	if(scope == 3)
	{
		document.getElementById('assetscope').value=2;
	}
	
	searchProjects(1);
}



//This method is used to extract a request parameter form a url.....

function getParameter(attribute)
{
	var result = null;
	var temp_url = document.location+"";
	var attributeArr = "";
	if(temp_url.indexOf("?")!=-1)
	{
		temp_url = temp_url.substring(temp_url.indexOf("?")+1,temp_url.length);
		attributeArr = Split_into_Array(temp_url,"&");
	}
	if(attributeArr!="")
	{
		for(k=0;k<attributeArr.length;k++)
		{
			var temp = Split_into_Array(attributeArr[k],"=");
			if(temp[0]==attribute)
			{
				result = temp[1];
				break;
			}			
		}
	}
	return result;
	
}

function renderChannelsPage(pageNo)
{
	var chSelId=document.getElementById('chSelId').value;
	
	//showLoading('channel_container');
	showLoading('wholecontainer');
 	//alert('chselid '+chSelId);
    var url= "/asynchronussearchProject_p2.do?&chSelId="+chSelId+"&pageNumber="+pageNo+"&fromcp=channel";
   
   	
	simplePost(url,"afterAjaxSearch(common_request)");
}

function sortByChannel(sortBy_Val)
{
	var chSelId=document.getElementById('chSelId').value;
	//showLoading('channel_container');
	showLoading('wholecontainer');
   	var url = "/sortchannel.do?&chSelId="+chSelId+"&sortBy="+sortBy_Val+"&fromcp=channel";
	simplePost(url,"afterAjaxSearch(common_request)");
}

//NO LONGER USE-IT IS CHANGED INTO JSP
/*function renderChannels(pageNo,asset) 
{
	//alert("renderchannel");
	displayOff('leftPagDiv');
	//alert('page :'+document.getElementById('channelPages').value)
	var userid = document.getElementById('userid').value;
	var useremail = document.getElementById('useremail').value;
	
	document.getElementById('channelPages').value = pageNo;
	var from = (pageNo-1) * channelPageLen;
	var upto = pageNo * channelPageLen;
	var bothTrue = false;
	document.getElementById('channel_nxt').innerHTML = "Next";
	document.getElementById('channel_prev').innerHTML = "Previous";
	document.getElementById('channel_prev').style.visibility = "hidden";
	document.getElementById('channel_nxt').style.visibility = "hidden";

	if(from>1){
		displayOn('leftPagDiv');
		bothTrue = true;
		document.getElementById('channel_prev').href = "javascript:renderChannels("+(pageNo-1)+")";
		document.getElementById('channel_prev').style.visibility = "visible";
	}else{
		displayOff('leftPagDiv');
		bothTrue = false;		
		document.getElementById('channel_prev').style.visibility = "hidden";
	}
	
	if(upto > (channelObjectArray.length-1))
	{
		upto = channelObjectArray.length;
		bothTrue = false;
		//document.getElementById('channel_nxt').style.visibility = "hidden";
		document.getElementById('channel_prev').style.visibility = "hidden";
		document.getElementById('channel_nxt').innerHTML = "Previous";
		document.getElementById('channel_nxt').href = "javascript:renderChannels("+(parseInt(pageNo)-1)+")";
		if(from>1)
		{
			displayOn('leftPagDiv');
			document.getElementById('channel_nxt').style.visibility = "visible";
		}	
	}else{
		if(!bothTrue)
			bothTrue = false;
		displayOn('leftPagDiv');	
		document.getElementById('channel_nxt').href = "javascript:renderChannels("+(parseInt(pageNo)+1)+")";
		document.getElementById('channel_nxt').style.visibility = "visible";
	}
	

	
	if(bothTrue){
		document.getElementById('splitter').style.visibility = "visible";
	}else{
		document.getElementById('splitter').style.visibility = "hidden";
	}
	
	/*var maxChId = 0;
	
	var channelsId =  new Array();
	for(j=0;j<channelObjectArray.length;j++){
		channelsId[j]=channelObjectArray[j].getChannelId();
	}
	
	for(var k=0;k<channelsId.length;k++){
		if(parseInt(maxChId)<parseInt(channelsId[k])){
			maxChId = channelsId[k];
		}
	}*/
	
	//alert("maxchid :"+maxChId);
	//alert("newchannel : "+newChannel);
	
	/*var inner_Text = "";
   		 for(i=from;i<upto;i++)
   		 {
			 if(ie)	
   		 		inner_Text += "<div style=\"position: relative; width: 255px;";
   		 	 else //why do we have this onclick event? set refresh=false since it's reloading action class twice
                inner_Text += "<div onclick='goDivUrl(\""+base_Url+"/loadProjectChildren.do?refresh=false&pId="+channelObjectArray[i].getChannelId()+"&listIndex="+i+"&channelPno="+pageNo+"&forceCache=true\");' style=\"position: relative; width: 255px;";

			var test = document.location+"";
			/*if(test.indexOf("reloadchannel=true")!=-1 && getParameter("pId")==channelObjectArray[i].getChannelId()){
				document.location = base_Url+"/loadProjectChildren.do?pId="+channelObjectArray[i].getChannelId()+"&listIndex="+i+"&channelPno="+pageNo+"&forceCache=true";
			}It makes the call twice*/  
			//alert(" useremail : " + useremail + " userid : " + userid + " lockuserid : " + channelObjectArray[i].getLockuserid());
			/*if(newChannel) 
			{
				var maxChId = 0;
				var channelsId =  new Array();
				for(j=0;j<channelObjectArray.length;j++)
				{
				channelsId[j]=channelObjectArray[j].getChannelId();
				}
	
				for(var k=0;k<channelsId.length;k++)
				{
					if(parseInt(maxChId)<parseInt(channelsId[k])){
						maxChId = channelsId[k];
						listIndex=k;
					}
				}
	   		    //alert("herenewchannel "+maxChId+" listindex :"+listIndex);	
		   		pageno=parseInt(listIndex/channelPageLen);	
		   		pageno=pageno+1;
		   		//alert("pageno :"+pageno);	 
		   		document.location = base_Url+"/loadProjectChildren.do?pId="+maxChId+"&listIndex="+listIndex+"&channelPno="+pageno+"&forceCache=true";
				return false;
			} 		 
	   		
	   		if(!newChannel)
	   		{  		   		
		   		  if(getParameter("pId")==channelObjectArray[i].getChannelId())
		   		 {
		   		
		   		 	 var pid=channelObjectArray[i].getChannelId();
		   		 	 var channelCaption=channelObjectArray[i].getObjectFullCaption();
		   		 	 inner_Text += "cursor:pointer;background-color:rgb(210, 253, 183); \" ";
		   		 	 document.getElementById("deletechannel").innerHTML='<a href="#" onClick="javascript:confirmDeleteChannel('+pid+');return false;">Delete</a>'
		   		 	 document.getElementById("renamechannel").innerHTML='<a href="#" onClick="javascript:renameChannel(\'\',\''+escape(channelCaption)+'\','+pid+');layerOn(\'rename\');return false;">Rename</a>'
		   		 	 document.getElementById('pidfordel').value = pid;
		   		 }	
		   		 else
		   		 { 
			   		 	 inner_Text += "cursor:pointer;background-color: rgb(255, 255, 255); \" onmouseover=\"this.style.backgroundColor='#EBFECB';\" onmouseout=\"this.style.backgroundColor='#ffffff';\"";
		   		 }
   			}
   			//alert(channelObjectArray[i].getChannelCaption());
   		 	inner_Text += " >"+
                            "<div style=\"float: left; padding: 5px; 0px\"><a href=\""+base_Url+"/loadProjectChildren.do?pId="+channelObjectArray[i].getChannelId()+"&listIndex="+i+"&channelPno="+pageNo+"&forceCache=true\"><img src=\""+channelObjectArray[i].getSiteIcon()+"\" border=\"0\"></a></div>"+
							"<div style=\"float: left; padding: 3px;\">";
				   if(channelObjectArray[i].getLockuserid() == '-1'){			
                   inner_Text +="<p class=\"copy09_blue_noul\" title=\""+channelObjectArray[i].getObjectFullCaption()+"\" style=\"vertical-align: right;\"><a href=\""+base_Url+"/loadProjectChildren.do?pId="+channelObjectArray[i].getChannelId()+"&listIndex="+i+"&channelPno="+pageNo+"&forceCache=true\">"+channelObjectArray[i].getChannelCaption()+"</a><div style=\"float: right; position: absolute; top: 5px; right: 5px;\"><a href=\"javascript:layerOn('lock"+channelObjectArray[i].getChannelId()+"');\"><img src=\"skins/main/images/account/icons/open.gif\" border=\"0\"></a></div></p>";
                   }else{
                   inner_Text +="<p class=\"copy09_blue_noul\" title=\""+channelObjectArray[i].getObjectFullCaption()+"\" style=\"vertical-align: right;\"><a href=\"javascript:layerOn('load"+channelObjectArray[i].getChannelId()+"');\">"+channelObjectArray[i].getChannelCaption()+"</a><div style=\"float: right; position: absolute; top: 5px; right: 5px;\"><a href=\"javascript:layerOn('ulock"+channelObjectArray[i].getChannelId()+"');\"><img src=\"skins/main/images/account/icons/closed.gif\" border=\"0\"></a></div></p>";
                   }
				   inner_Text +="<p class=\"copy09_blue_noul\" style=\"vertical-align: right;\">Modified: "+channelObjectArray[i].getChannelCreationDate()+"</p>"+
							"</div>"+
							"<div style=\"clear: both;\"></div>"+
						"</div>"+
						"<div id=\"ulock"+channelObjectArray[i].getChannelId()+"\" style=\"z-index: 500; position:relative; visibility:hidden;\">"+
									"<div style=\"z-index:501; position: absolute; width: 350px; top: 0px; *top: 0px; right: 0; border: 2px solid #999999; \">"+ 
										"<div style=\"z-index: 3;\">"+
											"<div style=\"padding: 2px 3px 2px 3px; height: 15px; background-color:#e4e4e4\">"+
												"<div style=\"float:left;\"><p class=\"copy09_blue_noul\"><b>Unlock Channel:</b></p></div>"+
											"</div>"+										
											"<div style=\"clear: both`; padding: 5px; background-color:#FFFFFF;\">"+
												"<div style=\"text-align:left; padding: 0px 10px 0px 5px;\"><p>Enter Password:</p></div>"+
												"<div style=\"text-align:left; padding: 0px 10px 5px 5px;\"><p><input type=\"password\" name=\"ulockpassword"+i+"\" id=\"ulockpassword"+i+"\" class=\"inputelement\" style=\"width: 330px;\" onkeypress=\"submitULockOnEnter(this, event, '"+channelObjectArray[i].getChannelId()+"','"+i+"');\"></p></div>"+
												"<div style=\"clear: both;\"></div>";
												if(channelObjectArray[i].getLockuserid() != '-1'){
												inner_Text +=
													"<div style=\"text-align:left; padding: 0px 10px 0px 5px;\"><p>Locked By: "+channelObjectArray[i].getLockuseremail()+"</p></div>";
													if(channelObjectArray[i].getLockuserid() == userid){	
													inner_Text +=
														"<div style=\"text-align:left; padding: 2px 10px 0px 5px;\"><p class=\"copy09_blue_noul\"><a href=\"javascript:sendChannelLockPassword('"+channelObjectArray[i].getChannelId()+"','"+channelObjectArray[i].getLockuseremail()+"','"+channelObjectArray[i].getLockuserid()+"');\">Forgot Password</a></p></div>";
													}
												}
										    inner_Text +=
											"</div>"+
											"<div style=\"border-top: 1px solid #999; background-color:#f2f2f2; padding: 3px 3px 0px 3px; text-align:right\"><p class=\"copy09_blue_noul\"><a href=\"javascript:layerOff('ulock"+channelObjectArray[i].getChannelId()+"');\"><img src=\"skins/main/images/account/buttons/cancel2dwbg_off.gif\" border=\"0\"></a> <a href=\"javascript:ulockChannel('"+channelObjectArray[i].getChannelId()+"','"+i+"'); \"><img src=\"skins/main/images/account/buttons/unlock_off.gif\" border=\"0\"></a></p></div>"+
										"</div>"+
									"</div>"+
									"<iframe style=\"z-index: 500; right: 0px; position: absolute; top: 0px; width: 0px; *width: 350px; height: 0px; *height: 158px;\" frameBorder=\"0\" scrolling=\"no\"></iframe>"+
								"</div>"+								
								"<div id=\"lock"+channelObjectArray[i].getChannelId()+"\" style=\"z-index: 500; position:relative; visibility:hidden;\">"+
									"<div style=\"z-index:501; position: absolute; width: 350px; top: 0px; *top: 0px; right: 0; border: 2px solid #999999; \">"+ 
										"<div style=\"z-index: 3;\">"+
											"<div style=\"padding: 2px 3px 2px 3px; height: 15px; background-color:#e4e4e4\">"+
												"<div style=\"float:left;\"><p class=\"copy09_blue_noul\"><b>Lock Channel:</b></p></div>"+
											"</div>"+											
											"<div style=\"clear: both`; padding: 5px; background-color:#FFFFFF;\">"+
												"<div style=\"text-align:left; padding: 0px 10px 0px 5px;\"><p>Enter Password:</p></div>"+
												"<div style=\"text-align:left; padding: 0px 10px 5px 5px;\"><p><input type=\"password\" name=\"lockpassword"+i+"\" id=\"lockpassword"+i+"\" class=\"inputelement\" style=\"width: 330px;\"></p></div>"+
												"<div style=\"text-align:left; padding: 0px 10px 0px 5px;\"><p>Verify Password:</p></div>"+
												"<div style=\"text-align:left; padding: 0px 10px 5px 5px;\"><p><input type=\"password\" name=\"vlockpassword"+i+"\" id=\"vlockpassword"+i+"\" class=\"inputelement\" style=\"width: 330px;\" onkeypress=\"submitLockOnEnter(this, event, '"+channelObjectArray[i].getChannelId()+"','"+i+"');\"></p></div>"+
											"</div>"+
											"<div style=\"border-top: 1px solid #999; background-color:#f2f2f2; padding: 3px 3px 0px 3px; text-align:right\"><p class=\"copy09_blue_noul\"><a href=\"javascript:layerOff('lock"+channelObjectArray[i].getChannelId()+"');\"><img src=\"skins/main/images/account/buttons/cancel2dwbg_off.gif\" border=\"0\"></a> <a href=\"javascript:lockChannel('"+channelObjectArray[i].getChannelId()+"','"+i+"');\"><img src=\"skins/main/images/account/buttons/lock_off.gif\" border=\"0\"></a></p></div>"+
										"</div>"+	
									"</div>"+
									"<iframe style=\"z-index: 500; right: 0px; position: absolute; top: 0px; width: 0px; *width: 350px; height: 0px; *height: 158px;\" frameBorder=\"0\" scrolling=\"no\"></iframe>"+
								"</div>";
					inner_Text+="<div id=\"load"+channelObjectArray[i].getChannelId()+"\" style=\"z-index: 500; position:relative; visibility:hidden;\">"+
									"<div style=\"z-index:501; position: absolute; width: 350px; top: 0px; *top: 0px; right: 0; border: 2px solid #999999; \">"+ 
										"<div style=\"z-index: 3;\">"+
											"<div style=\"padding: 2px 3px 2px 3px; height: 15px; background-color:#e4e4e4\">"+
												"<div style=\"float:left;\"><p class=\"copy09_blue_noul\"><b>Load Channel:</b></p></div>"+
											"</div>"+										
											"<div style=\"clear: both`; padding: 5px; background-color:#FFFFFF;\">"+
												"<div style=\"text-align:left; padding: 0px 10px 0px 5px;\"><p>Enter Password:</p></div>"+
												"<div style=\"text-align:left; padding: 0px 10px 5px 5px;\"><p><input type=\"password\" name=\"ullockpassword"+i+"\" id=\"ullockpassword"+i+"\" class=\"inputelement\" style=\"width: 330px;\" onkeypress=\"submitLoadOnEnter(this, event, '"+base_Url+"/loadProjectChildren.do?pId="+channelObjectArray[i].getChannelId()+"&listIndex="+i+"&channelPno="+pageNo+"&forceCache=true','"+channelObjectArray[i].getChannelId()+"','"+i+"');\"></p></div>"+
												"<div style=\"clear: both;\"></div>";
												if(channelObjectArray[i].getLockuserid() != '-1'){
												inner_Text +=
													"<div style=\"text-align:left; padding: 0px 10px 0px 5px;\"><p>Locked By: </p></div>"+
													"<div style=\"text-align:left; padding: 2px 10px 0px 5px;\"><p class=\"copy09_blue_noul\"><a href=\"\">Forgot Password</a></p></div>";
												}
										    inner_Text +=
											"</div>"+
											"<div style=\"border-top: 1px solid #999; background-color:#f2f2f2; padding: 3px 3px 0px 3px; text-align:right\"><p class=\"copy09_blue_noul\"><a href=\"javascript:layerOff('load"+channelObjectArray[i].getChannelId()+"');\"><img src=\"skins/main/images/account/buttons/cancel2dwbg_off.gif\" border=\"0\"></a> <a href=\"javascript:loadlockedchannel('"+base_Url+"/loadProjectChildren.do?pId="+channelObjectArray[i].getChannelId()+"&listIndex="+i+"&channelPno="+pageNo+"&forceCache=true','"+channelObjectArray[i].getChannelId()+"','"+i+"'); \"><img src=\"skins/main/images/account/buttons/continue_a_off.gif\" border=\"0\"></a></p></div>"+
										"</div>"+
									"</div>"+
									"<iframe style=\"z-index: 500; right: 0px; position: absolute; top: 0px; width: 0px; *width: 350px; height: 0px; *height: 158px;\" frameBorder=\"0\" scrolling=\"no\"></iframe>"+
								"</div>";	
	 	
   		 }
   		 //alert("innerHtml :"+inner_Text);
  		 document.getElementById('channel_container').innerHTML = inner_Text;
  		 document.getElementById('loading_image').style.display = "none";
  		 //alert("asset :"+asset);
  		 if(asset==2)
  		 {
  		 	asset2();
  		 }else if(asset==3)
  		 {
  		 	asset3();

  		 }
  		 newChannel=false;
}
*/
function deleteChannel()
{
	var channelid = document.getElementById("pidfordel").value;
	var pass = document.getElementById('realpwd').value;	
	if(pass.length > 0)
	{
		var url=base_Url+"/checkpassword_p2.do?password="+pass;
		var callBack="afterPasswordCheck(common_request,'"+channelid+"');"
		simplePost(url,callBack);
		
	
	}else{
		alert("Please enter the password..");
		displayOn("deleteitem");
	}
	
}

function lockChannel(channelId, index){
	var password = document.getElementById("lockpassword" + index).value;	
	var vpassword = document.getElementById("vlockpassword" + index).value;	
	
	if(password.length < 6  || password.indexOf(' ') != -1){
		alert("Your password must be at least 6 characters long with no spaces.");
	}else if(password != vpassword){
		alert("Please make sure your password and password verification match.");
	}else{
		//showLoading('channel_container');
		var pageno=document.getElementById('channelPages').value;
		showLoading('wholecontainer');
		var url=base_Url+"/lockchannel.do?password="+password+"&cid="+channelId+"&action=lock";
		var callBack="afterlockchannel(common_request,'"+channelId+"','"+index+"','"+pageno+"');"
		simplePost(url,callBack);
		
	}
}

function ulockChannel(channelId, index){
	var password = document.getElementById("ulockpassword" + index).value;
	if(password.length < 6  || password.indexOf(' ') != -1){
		alert("Your password must be at least 6 characters long with no spaces.");
	}else{
		//showLoading('channel_container');
		var pageno=document.getElementById('channelPages').value;
		showLoading('wholecontainer');
		var url=base_Url+"/lockchannel.do?password="+password+"&cid="+channelId+"&action=unlock";
		var callBack="afterulockchannel(common_request,'"+channelId+"','"+index+"','"+pageno+"');"
		simplePost(url,callBack);
	}
}

function loadlockedchannel(url, channelId, index){

	var password = document.getElementById("ullockpassword" + index).value;
	if(password.length < 6  || password.indexOf(' ') != -1){
		alert("Your password must be at least 6 characters long with no spaces.");
	}else{		
		var aurl=base_Url+"/checkchannellockpassword.do?password="+password+"&cid="+channelId;
		var callBack="afterlockpasswordcheck(common_request,'"+url+"','"+channelId + "','"+index+"');"
		simplePost(aurl,callBack);
	}
}

function afterlockchannel(request,channelId, index,pageno)
{
	if(request.responseText=="Failure")
	{
		alert("There was a problem while locking channel. Please try again.");
		document.getElementById('loading_image').style.display = "none";	
		layerOff("lock"+channelId); 
	}
	
	
	layerOff("lock"+channelId); 
	searchProjects(pageno);
	document.getElementById('loading_image').style.display = "none";		


}

function afterlockpasswordcheck(request,url, channelId, index)
{
	if(request.responseText=="Failure")
	{
 		alert("There was a problem while password. Please try again."); 			
 		 
	}else if(request.responseText=="wrongpassword"){
		alert("The password you entered was incorrect. Please try again.");			 
	}else{		
		document.location = url;
	}
	
	

}

function afterulockchannel(request,channelId, index,pageno)
{
	if(request.responseText=="Failure")
	{
 		alert("There was a problem while unlocking channel. Please try again.");
 		 
	}if(request.responseText=="wrongpassword"){
		alert("The password you entered was incorrect. Please try again.");
		 
	}
	
	//var pageno=document.getElementById('channelPages').value;
	layerOff("ulock"+channelId); 
	searchProjects(pageno);
	document.getElementById('loading_image').style.display = "none";		


}

function submitLockOnEnter(inputElement, event, channelId, index){
	if (event.keyCode == 13) { // No need to do browser specific checks. It is always 13.
        lockChannel(channelId, index);
    }
}



function submitULockOnEnter(inputElement, event, channelId, index){
	if (event.keyCode == 13) { // No need to do browser specific checks. It is always 13.
        ulockChannel(channelId, index);
    }
}

function submitLoadOnEnter(inputElement, event, url, channelId, index){
	if (event.keyCode == 13) { // No need to do browser specific checks. It is always 13.
        loadlockedchannel(url, channelId, index);
    }
}

function sendChannelLockPassword(channelId, lockUserEmail, lockUserId){
	layerOff("ulock"+channelId); 
	var url="sendchannellockpasswordmail.do?useremail=" + lockUserEmail + "&userid=" + lockUserId + "&cid=" + channelId;
	var callBack="processloackpasswordmail(common_request, '"+lockUserEmail+"');";
	simplePost(url,callBack);	
}

function processloackpasswordmail(request, useremail){
	var text = request.responseText;	
     if(text == 'Success'){
			alert("An email was sent to " + useremail + " with the lock password.");
		}
		else {
			alert("There was a problem in sending mail. Please try again.");
		}
}

function confirmDeleteChannel(channelid)
{
	document.getElementById('pidfordel').value = channelid;
	document.getElementById('realpwd').value = '';
	displayOn("deleteitem");
	
}

function afterPasswordCheck(request,channelid)
{
	var objectType="channel";
	var locreturn=base_Url+"/searchProject_p2.do";
	var resultBoolean="";
	var password="";
	var pId=0;
	resultBoolean = request.responseXML.getElementsByTagName('password');
	password = resultBoolean.item(0).firstChild.nodeValue;
	if(getParameter("pId")){
		pId = getParameter("pId");
		pId = pId.replace("#","");
	}	
	
	
	if(password=="true")
	{	
		var url=base_Url+"/a1deleteobject_p2.do?odl="+channelid+"&oType="+objectType+"&loc_return="+locreturn+"&pId="+escape(pId);
		window.location.href = url;
	}
	else
	{
		alert("The password you entered is incorrect. Please try again.");
		confirmDeleteChannel(channelid);
	}
}
	
	/*if (name==true)
	{
		var url="a1deleteobject_p2.do?odl="+channelid+"&oType="+objectType+"&loc_return="+locreturn;
		obj.href=url;
	}*/	

function renameChannel(obj,channelCaption,channelid)
{
	if(obj=="")
	{
		document.getElementById('renameChannelresult').innerHTML="";
		document.getElementById('renameChannelId').value=channelid;
		document.getElementById('renameChannelText').value=unescape(channelCaption);
	}else
	{
		channelid=document.getElementById('renameChannelId').value;
		channelCaption=document.getElementById('renameChannelText').value;
		
		if(channelCaption == "")
		{
			document.getElementById('renameChannelresult').style.visibility ="visible";
			document.getElementById('renameChannelresult').innerHTML="Title field Should not be empty";
			document.getElementById('renameChannelText').focus();
		}	
		if(channelCaption.length>0)
		{		
			var pageno=document.getElementById('channelPages').value;
			var url="renamechannelaction.do?odl="+channelid+"&objCaption="+channelCaption;
			var callBack = "AfterRenameChannel(common_request,\""+channelCaption+"\",'"+pageno+"');";
			//showLoading('wholecontainer');
			//obj.href=url;
			simplePost(url,callBack);
			//document.getElementById('channelProjectName').innerHTML=channelCaption;
		}
	}
}

function AfterRenameChannel(request,channelCaption,pageno)
{
	if(request.responseText=="alreadyexists")
	{
 		document.getElementById('renameChannelresult').style.visibility ="visible";
		document.getElementById('renameChannelresult').innerHTML="A channel with that name already exists.\n Please use a different name.";
		document.getElementById('renameChannelText').focus();
	}else{
	
		//var pageno=document.getElementById('channelPages').value;
		document.getElementById('renameChannelresult').innerHTML="";
		searchProjects(pageno);
		
 		document.getElementById('channelProjectName').innerHTML=channelCaption;
 		layerOff('rename');
	}

}



function goDivUrl(url){

	//It makes the call twice
	//window.location.href = url;
}

var currentUrl;


function showLoading(relativeId)
{
	try{
		/*
		var extraWidth = document.getElementById(relativeId).offsetWidth/2;
		var extraHeight = document.getElementById(relativeId).offsetHeight/2;
		
		document.getElementById('loading_image').style.display = "block";
		document.getElementById('loading_image').style.left = findPosX(document.getElementById(relativeId))+extraWidth;
		document.getElementById('loading_image').style.top = findPosY(document.getElementById(relativeId))+extraHeight;
		*/	
		if(document.getElementById('loading_image'))
			document.getElementById('loading_image').style.display = "none";	
		document.getElementById(relativeId).innerHTML = '<div  style="padding: 20px; text-align: center;"><p><img src="skins/default_styles/html/pickledefault/images/loading_ani.gif"></p></div>';
	}catch(e){}
}
function reloadAjax(url,from,customMethod)
{
	//alert("reloadajaxurl :"+url);
	showLoading('rootcontainer');
	//alert("url :"+url);
	
	var callBack = "afterAjaxReload(common_request,'"+url+"','"+from+"');";
	if(customMethod!="" && customMethod!=undefined && customMethod!="undefined")
	{
		callBack += customMethod;
	}
	simplePost(url,callBack);
}

function reloada1bodyAjax(url,pageParam)
{
	showLoading('rootTable');
	
	var callBack = "afterAjaxa1bodyReload(common_request,'"+url+"','"+pageParam+"');";
	/*if(customMethod!="" && customMethod!=undefined && customMethod!="undefined")
	{
		callBack += customMethod;
	}*/
	
	simplePost(url,callBack);
}

function recount(_id)
{
try{
	if(document.getElementById('count'))
		document.getElementById(_id).innerHTML =getStringNumericForm(document.getElementById('count').value);
	}catch(e){}
}
var timer_val
function afterAjaxReload(request,url,from,third)
{
	//document.getElementById('loading_image').style.display = "block";

	currentUrl = url;
	//alert("currenturl :"+currentUrl)
	if( document.getElementById('rootcontainer') !=null )
	{
		//var name =prompt("url",request.responseText);
		//document.getElementById('rootcontainer').innerHTML = "<table></table>";
		//document.getElementById('rootcontainer').style.display = "none";
		//document.getElementById('rootTd').removeChild( document.getElementById('rootcontainer'));
		document.getElementById('rootcontainer').innerHTML="";
		document.getElementById('rootcontainer').innerHTML = request.responseText;
	}
	//rootDiv = document.createElement('div');
	//rootDiv.id = 'rootcontainer';
	//rootDiv.style.width = "600px"; 
	//rootDiv.style.display = "none";
	//rootDiv.innerHTML = request.responseText;
	
	//document.body.appendChild(rootDiv);
	
	handleRadio(false);
	if(from!="pagi")
		reloadPagination()
	
	
	recount(document.getElementById('a1menutab1').value);
	recount(document.getElementById('a1menutab2').value);
	renderDelay();
}

function afterAjaxa1bodyReload(request,url,pageParam)
{
	//var name=prompt("request responsetext :",request.responseText);
	//alert(url);
	
	var finalUrl;
	
  	if(url.indexOf("&from")!=-1)
  	{
  		finalUrl=url.substring(0,url.indexOf("&from"));
  	}
  	//alert("finalurl :"+finalUrl);
	currentUrl = finalUrl+"&from="+pageParam;
	//alert("currentUrl :"+currentUrl);
	if( document.getElementById('rootTable') !=null )
	{
		
		document.getElementById('rootTable').innerHTML="";
		document.getElementById('rootTable').innerHTML = request.responseText;
	}
	//alert("here");
	reloadPagination();
	//recount('total_child_counts');
	//recount('total_pv_counts');
	
	recount(document.getElementById('a1menutab1').value);
	recount(document.getElementById('a1menutab2').value);
	
}



function renderDelay()
{
	//document.getElementById('rootTd').appendChild(document.getElementById('rootcontainer'));
	document.getElementById('rootcontainer').style.display = "block";
	document.getElementById('loading_image').style.display = "none";
	
}
function handleRadio(para)
{
	try
	{
	 document.getElementById('collection_option').disabled = para;
	 document.getElementById('comment_option').disabled = para;
	 document.getElementById('photo_option').disabled = para;
	 if(para)
	 {
	 	
	 	document.getElementById('loading_image').style.left = findPosX(document.getElementById('collection_option'))+250;
	 	document.getElementById('loading_image').style.top = findPosY(document.getElementById('collection_option'))+100;
	 	
	 	//This code handle by showloading
	 	//document.getElementById('loading_image').style.display = "block";
	 	
	 	document.getElementById('loading_image').style.display = "none";
	 }
	 else
	 	document.getElementById('loading_image').style.display = "none";
	}catch(e){}
}
function reloadBodyAfterChangeStatus(request)
{
	//var name=prompt("request",request.responseText);
	var featureClipPath="";
	var featureImagePath="";
	var xmlContent = request.responseText;
	//alert("xmlcontent : "+xmlContent)
	if(xmlContent.indexOf("featureClipPath")!=-1)
		{
			//alert("u r here;");
			featureClipPath=request.responseXML.getElementsByTagName('featureClipPath');
			featureImagePath=featureClipPath.item(0).firstChild.nodeValue;
			//alert("fip : "+featureImagePath)
			if(featureImagePath != null && featureImagePath != "NO_LIVE_ITEM" && featureImagePath != "N/A" )
   			{
   				document.getElementById('changeFeatureItem').style.backgroundImage="url('"+featureImagePath+"')";
   				document.getElementById('dummayCFIClick').style.display='none';
   				document.getElementById('changeFeatureItemClick').style.display='block';
   				document.getElementById('changeFeatureItemLink').style.display='block';	
   				
   			}else if(featureImagePath != null && featureImagePath!= "N/A" && featureImagePath == "NO_LIVE_ITEM")
   			{
   				document.getElementById('changeFeatureItem').style.backgroundImage="url(skins/main/images/account/icons/noliveitems.gif)";
   				document.getElementById('dummayCFIClick').style.display='block';
   				document.getElementById('changeFeatureItemClick').style.display='none';
   				//document.getElementById('changeFeatureItemClick').onclick="";
   				document.getElementById('changeFeatureItemLink').style.display='none';
   				//document.getElementById('changeFeatureItemLink').innerHTML=" ";
   				
   			}else
   			{
   				document.getElementById('changeFeatureItem').style.backgroundImage="url(skins_p2/main/images/account/emptycollection.gif)";
   				document.getElementById('dummayCFIClick').style.display='block';
   				document.getElementById('changeFeatureItemClick').style.display='none';
   				//document.getElementById('changeFeatureItemClick').onclick="";
   				document.getElementById('changeFeatureItemLink').style.display='none';
   				//document.getElementById('changeFeatureItemLink').innerHTML=" ";
   			}
   		}
	/*var featureClipPath="";
	var featureImagePath="";
	var featureItemBoolean=request.responseXML.getElementsByTagName('isFeatureItem');
	var xmlContent = request.responseText;
	
	//alert("feature outside loop"+featureImagePath);
	var deleteArr = new Array();
	for(i=0;i<featureItemBoolean.length;i++)
   		{
   			if(featureItemBoolean.item(i).firstChild.nodeValue=="true")
   			{
   				alert("You can't delete a featured item or make its status inactive.\nPlease choose a different featured item before making this change.");
   				//document.getElementById('changeFeatureItem').style.background-image = ''
   			}
   			
   		}
   		if(xmlContent.indexOf("featureClipPath")!=-1)
		{
			//alert("here");
			featureClipPath=request.responseXML.getElementsByTagName('featureClipPath');
			featureImagePath=featureClipPath.item(0).firstChild.nodeValue;
			document.getElementById('changeFeatureItem').style.backgroundImage="url('"+featureImagePath+"')";
			document.getElementById('changeFeatureItemLink').innerHTML="Change Featured Item";	
		}*/
		reloadAjax(currentUrl);	

}
function reloadBodyAfterDelete(request)
{
	
	var featureClipPath="";
	var featureImagePath="N/A";
	var xmlContent = request.responseText;
	if(xmlContent.indexOf("featureClipPath")!=-1)
		{
			
			featureClipPath=request.responseXML.getElementsByTagName('featureClipPath');
			//alert("feimagepath : "+featureClipPath.item(0).firstChild);
			if(featureClipPath.item(0).firstChild!=null)
				featureImagePath=featureClipPath.item(0).firstChild.nodeValue
			//alert("fip : "+featureImagePath);
			if(featureImagePath != null && featureImagePath != "NO_LIVE_ITEM" && featureImagePath != "N/A" )
   			{
   				document.getElementById('changeFeatureItem').style.backgroundImage="url('"+featureImagePath+"')";
   				document.getElementById('dummayCFIClick').style.display='none';
   				document.getElementById('changeFeatureItemClick').style.display='block';
   				document.getElementById('changeFeatureItemLink').style.display='block';
   				
   			}else if(featureImagePath != null && featureImagePath!= "N/A" && featureImagePath == "NO_LIVE_ITEM")
   			{
   				document.getElementById('changeFeatureItem').style.backgroundImage="url(skins/main/images/account/icons/noliveitems.gif)";
   				document.getElementById('dummayCFIClick').style.display='block';
   				document.getElementById('changeFeatureItemClick').style.display='none';
   				//document.getElementById('changeFeatureItemClick').onclick="";
   				document.getElementById('changeFeatureItemLink').style.display='none';
   				//document.getElementById('changeFeatureItemLink').innerHTML=" ";
   				
   			}else
   			{
   				document.getElementById('changeFeatureItem').style.backgroundImage="url(skins_p2/main/images/account/emptycollection.gif)";
   				document.getElementById('dummayCFIClick').style.display='block';
   				document.getElementById('changeFeatureItemClick').style.display='none';
   				//document.getElementById('changeFeatureItemClick').onclick="";
   				document.getElementById('changeFeatureItemLink').style.display='none';
   				//document.getElementById('changeFeatureItemLink').innerHTML=" ";
   			}
   		}
	/*var featureClipPath=request.responseXML.getElementsByTagName('featureClipPath');
	var deleteArr = new Array();
	for(i=0;i<featureClipPath.length;i++)
   		{
   			var featureImagePath=featureClipPath.item(i).firstChild.nodeValue
   			//alert("feature"+featureImagePath);
   			//alert("You can't delete a featured item or make its status inactive.\nPlease choose a different featured item before making this change.");
   			if(featureImagePath != null && featureImagePath != "NO_LIVE_ITEM" && featureImagePath != "N/A" )
   			{
   				document.getElementById('changeFeatureItem').style.backgroundImage="url('"+featureImagePath+"')";
   			}else if(featureImagePath != null && featureImagePath!= "N/A" && featureImagePath == "NO_LIVE_ITEM")
   			{
   				document.getElementById('changeFeatureItem').style.backgroundImage="url(skins/main/images/account/icons/noliveitems.gif)";
   				document.getElementById('changeFeatureItemClick').onclick="";
   				document.getElementById('changeFeatureItemLink').innerHTML=" ";
   				
   			}else
   			{
   				document.getElementById('changeFeatureItem').style.backgroundImage="url(skins_p2/main/images/account/emptycollection.gif)";
   				document.getElementById('changeFeatureItemClick').onclick="";
   				document.getElementById('changeFeatureItemLink').innerHTML=" ";
   			}
   		}*/
		reloadAjax(currentUrl);	

}


function reloadBody()
{
	reloadAjax(currentUrl,"pagi");
}
function reloadBodyWithPagination()
{
	reloadAjax(currentUrl);
}
function moveTO(pageNo,obj)
{
	if(currentUrl.indexOf("pageNumber")!=-1)
	{
		currentUrl = currentUrl.substring(0,currentUrl.indexOf("&pageNumber"));
	}
	if( currentUrl.indexOf("pId")==-1 && (currentUrl.indexOf("from=PV")!=-1 || currentUrl.indexOf("from=COL")!=-1) ){
		currentUrl = currentUrl + "&pId="+ getParameter("pId");
	}
	var test = currentUrl+"&pageNumber="+pageNo;
	
	document.getElementById('pagination_1').selectedIndex = obj.selectedIndex;
	document.getElementById('pagination_2').selectedIndex = obj.selectedIndex;

	if( document.getElementById('rootcontainer') != null ){
		document.getElementById('rootcontainer').innerHTML = "";
	}
	//alert("testurl :"+test);
	reloadAjax(test,"pagi");
}

function getStringNumericForm(nStr,prefix)
{
  			var prefix = prefix || '';
  			nStr += '';
  			x = nStr.split('.');
  			x1 = x[0];
  			x2 = x.length > 1 ? '.' + x[1] : '';

  			var rgx = /(\d+)(\d{3})/;
  			while (rgx.test(x1))
      			x1 = x1.replace(rgx, '$1' + ',' + '$2');

  			return prefix + x1 + x2;
}

function reloadPagination(url)
{
	if(url!=undefined)
	{
		currentUrl=url;
	}
	
	var totalpages = 1;
	var pageno = 1;


	if(document.getElementById('total_pages'))
	{
		totalpages = parseInt(document.getElementById('total_pages').value);
	}
	
	
	if(document.getElementById('totalPages_PVB'))
	{	
		totalpages = parseInt(document.getElementById('totalPages_PVB').value);
	}	
	
	if(document.getElementById('page_no'))
	{
		pageno = parseInt(document.getElementById('page_no').value);
	}
	

	if(document.getElementById('pageNumber'))
	{
		pageno = parseInt(document.getElementById('pageNumber').value);

	}
	
	var pagesHtml = "<div><p>Page&nbsp;<select id='pagination_1' onchange=\"moveTO(this.value,this)\" style='vertical-align: middle;' class='inputelement'></p></div>"
	for(j=1;j<=totalpages;j++)
	{
			if(j==parseInt(pageno))
				pagesHtml += "<option value='"+j+"' selected>"+getStringNumericForm(j)+"</option>";
			else
				pagesHtml += "<option value='"+j+"'>"+getStringNumericForm(j)+"</option>";
	}
			
		pagesHtml += "</select> of "+getStringNumericForm(totalpages);


		
	var pagesHtml1 = "&nbsp;<div><p>Page&nbsp;<select id='pagination_2' onchange=\"moveTO(this.value,this)\" style='vertical-align: middle;' class='inputelement'></p></div>"
	
	for(j=1;j<=totalpages;j++)
	{
			if(j==parseInt(pageno))
				pagesHtml1 += "<option value='"+j+"' selected>"+getStringNumericForm(j)+"</option>";
			else
				pagesHtml1 += "<option value='"+j+"'>"+getStringNumericForm(j)+"</option>";
	}		
		pagesHtml1 += "</select> of "+getStringNumericForm(totalpages);

	var reloadFlag = false;
	if(document.getElementById('pagination_1')){
		if(parseInt(pageno)!= parseInt(document.getElementById('pagination_1').value)){
			reloadFlag = true;
		}
	}
		
	document.getElementById('mainpaginationarea').innerHTML = pagesHtml;
	//alert("reloadpagination")
	document.getElementById('mainpaginationarea2').innerHTML = pagesHtml1;
	//alert("reload Flag :"+reloadFlag);
	if(reloadFlag){	
		//alert("reloadflag here")	
		moveTO(pageno,document.getElementById('pagination_1'));
	}
	
	
}

function resetSearchvalues()
{
	document.getElementById('Seastatusdrop').value=0;
	document.getElementById('site').value=-1;
	document.getElementById('search_text').value="";
	
}
var maxChId=0;
function AfterChannelSave(request)
{
	
	if(request.responseText=="alreadyexists")
	{
 		document.getElementById('channelresult').style.display ="block";
		//document.getElementById('createcontainer').style.height = "105px";
		document.getElementById('channelresult').innerHTML="A channel with that name already exists.\n Please use a different name.";
		document.getElementById('channelTitle').focus();
	}else{
			//alert(request.responseText);
			maxChId=request.responseText;
			resetSearchvalues();
			document.getElementById('channelresult').innerHTML="";
	 		layerOff('wizard_choose');
	 		searchProjects(1);
	}

}
var newChannel =false;
function createChannel()
{
	//alert("here");
	var channeltitle=document.getElementById('channelTitle').value;
	var channeltags=document.getElementById('channelTags').value;
	var channelsite=document.getElementById('channelSite').value;	
	if(channeltitle == "")
	{
		document.getElementById('channelresult').style.display ="block";
		document.getElementById('channelresult').innerHTML="Please enter a name.";
		document.getElementById('channelTitle').focus();
		
	}
   
	if(channeltitle.length>0)
	{
		newChannel = true;
		var url = "a1createchannel_p2.do?channelTitle="+escape(channeltitle)+"&channelTags="+channeltags+"&channelSite="+channelsite;
		simplePost(url,"AfterChannelSave(common_request)");
		
	}
}

function postReload(url,callBack)
{
 var common_request=ie?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();
 common_request.onreadystatechange=function()
 {
  if(common_request.readyState==4)
  {
   if(common_request.status==200)
   { 	
         try
         {
        	 document.location.href = callBack;
         }catch(e){}
   }
  /* else if(common_request.status==500)
    alert(serverError);
   else
    alert(connectionError);*/
    
  }
 }
  
 var finalUrl = "";
 try{
 if(url.indexOf("http://")==-1)
 	finalUrl = base_Url+"/"+url;
 else
 	finalUrl = url;
 }catch(e){finalUrl = url;}
 common_request.open("POST",finalUrl,true);
 common_request.setRequestHeader("content-type","text/plain;charset=UTF-8");
 common_request.send(''); 
}

function simplePost(url,callBack)
{
 var common_request=ie?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();
 common_request.onreadystatechange=function()
 {
  if(common_request.readyState==4)
  {
   if(common_request.status==200)
   { 	
         try{eval(callBack);}catch(e){}
   }
  /* else if(common_request.status==500)
    alert(serverError);
   else
    alert(connectionError);*/
    
  }
 }
  
 var finalUrl = "";
 try{
 if(url.indexOf("http://")==-1)
 	finalUrl = base_Url+"/"+url;
 else
 	finalUrl = url;
 }catch(e){finalUrl = url;}
 common_request.open("POST",finalUrl,true);
 common_request.setRequestHeader("content-type","text/plain;charset=UTF-8");
 common_request.send(''); 
}

function postWithParam(url,callBack, params)
{
 var common_request=ie?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();
 common_request.onreadystatechange=function()
 {
  if(common_request.readyState==4)
  {
   if(common_request.status==200)
   { 	
         try{eval(callBack);}catch(e){}
   }
  /* else if(common_request.status==500)
    alert(serverError);
   else
    alert(connectionError);*/
    
  }
 }
  
 var finalUrl = "";
 try{
 if(url.indexOf("http://")==-1)
 	finalUrl = base_Url+"/"+url;
 else
 	finalUrl = url;
 }catch(e){finalUrl = url;}

 common_request.open("POST",finalUrl,true);
 common_request.setRequestHeader("content-type","text/plain;charset=UTF-8");

 common_request.send(params); 
}



function findPosX(obj)
	{
		 var curleft = 0
		 if (obj.offsetParent)
		 {
			  while (obj.offsetParent)
			  {
				   curleft += obj.offsetLeft
				   obj = obj.offsetParent
			  }
		 }
		 else if (obj.x)
		 	 curleft += obj.x
		 return curleft
	}
	function findPosY(obj)
	{
		 var curtop = 0
		 if (obj.offsetParent)
		 {
			  while (obj.offsetParent)
			  {
				   curtop += obj.offsetTop
				   obj = obj.offsetParent
			  }
		 }
		 else if (obj.y)
		  	curtop += obj.y
		 return curtop
	}
	
	/*
	 *This method takes the ajax action url and appends hidden fiels
	 *used for pagination and sorting.
	 */
	
	function createRootContainerUrl(url,lst,from)
	{
		var listIndex = document.getElementById('listIndex').value;
		var objType = document.getElementById('ot').value;
		var pageNo = document.getElementById('pageNumber').value;
		var sortBy = document.getElementById('sortBy').value;
		var sortOrder = document.getElementById('sortOrder').value;
		var siteId = document.getElementById('siteId').value;
		var parentId=document.getElementById('parentid').value;
		var url_final = url+"?listIndex="+listIndex+"&ot="+objType+"&lst="+lst+"&channelPno="+pageNo+"&sortBy="+sortBy+"&sortOrder="+sortOrder+"&siteId="+siteId+"&collectionId="+parentId+"&from="+from+"&pId="+parentId+"&pageNumber="+pageNo;
		reloadAjax(url_final);
	}
	
	function get_page(url, object,lst){
		var page_no = object.options[object.selectedIndex].value;
		document.getElementById("pageNumber").value = page_no;
		createRootContainerUrl(url,lst);
	}
	
	
	function sort_column(url, sort_by,lst,from){
		document.getElementById("sortBy").value = sort_by;
		//document.getElementById("sortOrder").value =1;
		//createRootContainerUrl(url,lst,from);
		toggle_order(url,lst,from);
	}
	
	function toggle_order(url,lst,from){
	
		if(document.getElementById("sortOrder").value == 1)
		{
			document.getElementById("sortOrder").value =2;
		}
		else
		{
			document.getElementById("sortOrder").value =1;
		}
		createRootContainerUrl(url,lst, from);
	}
	
	
	
		// Project Management
	function pm_apply_filter(siteid)
	{
		var prefix = "cp_";
		var sy=document.getElementById(prefix+'start_yyyy').value;
		var sd=document.getElementById(prefix+'start_dd').value;
		var sm=document.getElementById(prefix+'start_mm').value;
		var em=document.getElementById(prefix+'end_mm').value;
		var ed=document.getElementById(prefix+'end_dd').value;
		var ey=document.getElementById(prefix+'end_yyyy').value;
		var search_text=document.getElementById(prefix+'search_text').value;
		var tags=document.getElementById(prefix+'search_tag').value;
		
		pm_receive_projects(sy,sd,sm,em,ed,ey,siteid,"asst","1", tags, search_text,'sourceChannelList','move_channelpaginationcontainer','move')
	}
	function pm_remove_filter(siteid)
	{
		var prefix = "cp_";
		document.getElementById(prefix+'start_yyyy').value = 2008;
		document.getElementById(prefix+'start_dd').value = 1;
		document.getElementById(prefix+'start_mm').value = 1;
		document.getElementById(prefix+'end_mm').value = 12;
		document.getElementById(prefix+'end_dd').value = 31;
		document.getElementById(prefix+'end_yyyy').value = 2009;
		var sy=document.getElementById(prefix+'start_yyyy').value;
		var sd=document.getElementById(prefix+'start_dd').value;
		var sm=document.getElementById(prefix+'start_mm').value;
		var em=document.getElementById(prefix+'end_mm').value;
		var ed=document.getElementById(prefix+'end_dd').value;
		var ey=document.getElementById(prefix+'end_yyyy').value;
		document.getElementById(prefix+'search_text').value="";	
		document.getElementById(prefix+'search_tag').value="";	
		
		
		pm_receive_projects(sy,sd,sm,em,ed,ey,siteid,"asst","1", "", "",'sourceChannelList','move_channelpaginationcontainer','move')
	}
	
	function pm_receive_projects(syear,sdate,smonth,emonth,edate,eyear,siteId,asset,loadPageNo, tags, search_text,container_name,pagi_container,action)
 	{ 
 		
		document.getElementById('loading_image').style.left = findPosX(document.getElementById(container_name))+100;
		document.getElementById('loading_image').style.top = findPosY(document.getElementById(container_name));
		document.getElementById('loading_image').style.display = "block";
	 	cpmvchannelObjectArray = new Array();	 	
	    var url= "/searchProject_p2.do?ajax=Ajax&start_yyyy="+syear+"&start_mm="+smonth+"&start_dd="+sdate+"&end_yyyy="+eyear+"&end_mm="+emonth+"&end_dd="+edate+"&assetType="+asset+"&site="+siteId+"&tags="+tags+"&search_text="+search_text+"&copyormove=yes&sot=1&fp=pppm";
	    //alert(url);
	   	if(getParameter("listIndex")!=null && getParameter("listIndex")!="null")
	   	  url += "&listIndex="+getParameter("listIndex")
	   	//var a = prompt("test",url);
	    simplePost(url,"pm_displayChannelList(common_request,"+loadPageNo+",'"+container_name+"','"+pagi_container+"','"+action+"');");
	}
	function pm_displayChannelList(request,loadPageNo,container_name,pagi_container,action)
	{
		if(isNaN(loadPageNo))
			loadPageNo = 1;
		//try{
		//alert(request.responseText);
		cpmv_objIds = request.responseXML.getElementsByTagName('objectId');
   		cpmv_captions = request.responseXML.getElementsByTagName('objectCaption');
   		cpmv_dates = request.responseXML.getElementsByTagName('objectDate');
   		cpmv_siteicon=request.responseXML.getElementsByTagName('siteIconUrl');
   		
   		if(cpmv_objIds.length==0)
   		{
   			document.getElementById('loading_image').style.display = "none";
   			document.getElementById(container_name).innerHTML = "<p class=\"copy09_blue_noul\" align=\"center\" style=\"padding: 5px;\">No Results Found</p>";
   		}
   		//calculate total no of pages for channels pagination ....
   	
   		totalNoOfChannelsPage = Math.ceil(cpmv_objIds.length/cpmv_channelPageLen); 

   		// Regenerate the pages List ....
   		
   		var pagesHtml = "Page&nbsp;<select onchange=\"cpmv_renderChannels(this.value,'"+container_name+"','"+action+"')\" id='channelPages' style='vertical-align: middle;' class='copy09_blue_noul'>"
		
		for(j=1;j<=totalNoOfChannelsPage;j++)
			pagesHtml += "<option value='"+j+"'>"+j+"</option>";
			
		pagesHtml += "</select> of "+totalNoOfChannelsPage;
		
		//Append the Html into the pagination container ....
		
		//document.getElementById(pagi_container).innerHTML = pagesHtml;
		
		//Append Channel objects in Channel Array Objects ....	
   		
   		for(i=0;i<cpmv_objIds.length;i++)
   		 {
   		 	cpmvchannelObjectArray[i] = new Channel(cpmv_objIds.item(i).firstChild.nodeValue,cpmv_captions.item(i).firstChild.nodeValue,cpmv_dates.item(i).firstChild.nodeValue,cpmv_siteicon.item(i).firstChild.nodeValue);
   		 }
   		
   		if(cpmv_objIds.length>0)
   		{
   			pm_renderChannels(cpmv_objIds.length,container_name,action);
   		} 
   		
   		//}catch(e){alert(e.message);}
	}
	function pm_renderChannels(totalList,container_name,action)
	{
		var from = 0;
		var inner_Text = "<table><tbody id=\"sourceChannelListTbody\" >";
		for(i=from;i<totalList;i++)
	   	{
	   	 	inner_Text += "<tr valign=\"center\" id=\"tr_"+cpmvchannelObjectArray[i].getChannelId()+"\" ><td style=\"padding: 3px;\" id=\"td_" +cpmvchannelObjectArray[i].getChannelId()+ "\">";
	   	 	inner_Text += "<p><input id=\"check_" +cpmvchannelObjectArray[i].getChannelId() + "\" type=\"checkbox\" style=\"vertical-align:middle\" onclick=\"add_remove_check_list(this)\" > <img src=\""+cpmvchannelObjectArray[i].getSiteIcon()+"\" border=\"0\" style=\"vertical-align:middle\"><span id=\"caption_"+cpmvchannelObjectArray[i].getChannelId()+ "\"> " +cpmvchannelObjectArray[i].getChannelCaption()+  "</span></p></td></tr>";  
	   	}
	   	inner_Text += "</tbody></table>";
	   	
	  	document.getElementById(container_name).innerHTML = inner_Text;
	  	document.getElementById('loading_image').style.display = "none";
	}
	function beforechangeUploadedBy(pos)
	{
		//alert(pos);
		var total_selected_objs = document.getElementsByName("selected_obj[]");
		var total_to_delete = new Array();
		for(i=0;i<total_selected_objs.length;i++)
		{
			if(total_selected_objs[i].checked)
			{ 
				total_to_delete[total_to_delete.length] =  total_selected_objs[i].value;
			}
		}
		if(total_to_delete.length>0)
		{
				changeUploadedBy(total_to_delete,'',pos);
		}
		else	
		{
			alert("Please select an item to change.");
		}
	}
	
	//This function is used for A1,A1A,A3 since it requires userid,collectionid.
	function changeUploadedBy(collectionIds,fromPage,pos)
	{
		//alert(collectionIds);
		//alert(pos);
		var userName=document.getElementById('editup_title_field'+pos).value;
		var url= "/changeUploadedBy.do?userName="+userName+"&collectionIds="+collectionIds;
		//alert("edituploadedby"+pos);
		showLoading('edituploadedby'+pos);
		simplePost(url,"AfterchangeUploadedBy(common_request,'"+userName+"','"+fromPage+"','"+pos+"')");
	}
	
	function AfterchangeUploadedBy(request,userName,fromPage,pos)
	{
		if(request.responseText=="nouserfound")
		{
			document.getElementById('edituploadedby'+pos).style.display ="block";
			document.getElementById('edituploadedby'+pos).innerHTML="The email address you entered is not in our system. Please try again.";
			
		}else
		{
			//document.getElementById('edituploadedby'+pos).style.display ="block";
			//document.getElementById('edituploadedby'+pos).innerHTML ="Successfully changed";
			
			if(document.getElementById('uploadedbyemail'))//This is for a1a & a3 page alone
			{
				document.getElementById('uploadedbyemail').innerHTML=userName;
			}	
			if(document.getElementById('uploadedit'))//This is for a1a & a3 page alone
			{
				displayOff('uploadedit');
			}
			if(document.getElementById('upl'+pos))//This is for a1 page alone
			{
				displayOff('upl'+pos);
			}
			if(fromPage!='a3')
			{
				reloadBody();//Not a3 page(a1 & a1a only),  Used to reload the body
			}
			document.getElementById('edituploadedby'+pos).innerHTML="";
		}
		
	}
	
	//This function is used for Upload (A1 pages alone) since it requires only userid .doesnt need collectionid.
	function changeUploadedByUp()
	{
		var url="";
		var collectionId=document.getElementById('uploadedbycollectionid').value;
		var userName=document.getElementById('editup_title_fieldup').value;
		var uploadscreen="uploadscreen";
		if(collectionId!="" && collectionId!=undefined && collectionId!="undefined")
		{
			url= "/changeUploadedBy.do?userName="+userName+"&collectionIds="+collectionId+"&uploadedby="+uploadscreen;
		}else
		{
			url= "/changeUploadedBy.do?userName="+userName+"&uploadedby="+uploadscreen;
		}
		showLoading('edituploadedbyup');
		simplePost(url,"AfterchangeUploadedByUp(common_request,'"+userName+"')");
	}
	function AfterchangeUploadedByUp(request,userName)
	{
		if(request.responseText=="nouserfound")
		{
			document.getElementById('edituploadedbyup').style.display ="block";
			document.getElementById('edituploadedbyup').innerHTML="The email address you entered is not in our system. Please try again.";
			
		}else
		{
			var userId=request.responseText;
			//document.getElementById('edituploadedbyup').style.display ="block";
			//document.getElementById('edituploadedbyup').innerHTML ="Successfully changed";
			document.getElementById('edituploadedbyup').innerHTML ="";
			if(document.getElementById('uploadedbyemailup'))
				document.getElementById('uploadedbyemailup').innerHTML=userName;
			displayOff('uploadedit');
			showLoading('xupload');
			receive_upload_id(userId);
			//alert(request.responseText);

		}
	}
	
	

	
