// video rep code
function place_call(id, d_id) {
	var w = 460;
	var h = 300;
	var top = screen.height/2 - h/2;
	var left = screen.width/2 - w/2;
	var opts = "width=" + w + ",height=" + h + ",left=" + left + ",top=" + top + ",scrollbars=no, status=no";
	myURL = "http://www.customervideo.com/members/virtual_rep/place_call.php?id=" + id + "&d_id=" + d_id;
	callWindow = window.open(myURL, "call_window", opts);
}
function delete_meeting_check() 
{
	var check = confirm("Are you sure you want to delete the selected Meeting");
	if (check) 
	{
		document.delete_vid.submit();
	}
}
/* universal MM scripts */
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function writeDate(){
	var browser_name = navigator.appName;
	var this_month = new Array();
	this_month[0] = "January";
	this_month[1] = "February";
	this_month[2] = "March";
	this_month[3] = "April";
	this_month[4] = "May";
	this_month[5] = "June";
	this_month[6] = "July";
	this_month[7] = "August";
	this_month[8] = "September";
	this_month[9] = "October";
	this_month[10] = "November";
	this_month[11] = "December";
	var today = new Date();
	var day = today.getDate();
	var month = today.getMonth();
	var year = today.getYear();
	year <= 100 ? year += 1900 : 0;
	if ( (year<2000) && (browser_name=="Netscape") ) { year += 1900; }
	var hour = today.getHours();
	var minute = today.getMinutes();
	var time = today.getHours();
	if (time >= 12){
		if (time > 12){time -= 12;}
		today.getMinutes() < 10 ? time = time+":0"+today.getMinutes()+"pm " : time = time+":"+today.getMinutes()+"pm ";
	}
	else{
		if (time == 0){time = 12;}
		today.getMinutes() < 10 ? time = time+":0"+today.getMinutes()+"am " : time = time+":"+today.getMinutes()+"am ";
	}
	return(this_month[month] + " " + day + ", "+year+" - " + time);
}

/* floating layer script */
	// Script Source: CodeLifter.com
	// Copyright 2003
	// Do not remove this header

	isIE=document.all;
	isNN=!document.all&&document.getElementById;
	isN4=document.layers;
	isHot=false;

	function ddInit(e){
		topDog=isIE ? "BODY" : "HTML";
		whichDog=isIE ? document.all.theLayer : document.getElementById("theLayer");
		hotDog=isIE ? event.srcElement : e.target;
		while (hotDog.id!="titleBar"&&hotDog.tagName!=topDog){
			hotDog=isIE ? hotDog.parentElement : hotDog.parentNode;
		}
		if (hotDog.id=="titleBar"){
			offsetx=isIE ? event.clientX : e.clientX;
			offsety=isIE ? event.clientY : e.clientY;
			nowX=parseInt(whichDog.style.left);
			nowY=parseInt(whichDog.style.top);
			ddEnabled=true;
			document.onmousemove=dd;
		}
	}

	function dd(e){
		if (!ddEnabled) return;
		whichDog.style.left=isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx;
		whichDog.style.top=isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;
		return false;
	}

	function ddN4(whatDog){
		if (!isN4) return;
		N4=eval(whatDog);
		N4.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
		N4.onmousedown=function(e){
			N4.captureEvents(Event.MOUSEMOVE);
			N4x=e.x;
			N4y=e.y;
		}
		N4.onmousemove=function(e){
			if (isHot){
				N4.moveBy(e.x-N4x,e.y-N4y);
				return false;
			}
		}
		N4.onmouseup=function(){
			N4.releaseEvents(Event.MOUSEMOVE);
		}
	}

	function hideMe(){
		if (isIE||isNN){
		  whichDog.style.visibility="hidden";		
		}
		else if (isN4){
    		document.theLayer.visibility="hide";
		}else{
			 whichDog.style.visibility="hidden"
		}
		//document.email_form.template_id.style.visibility = "visible";
			//document.email_form.GroupID.style.visibility = "visible";
			//document.email_form.InternalGroupID.style.visibility = "visible";
			//document.email_form.saved_video.style.visibility = "visible";
			//document.email_form.FooterID.style.visibility = "visible";
		return false;
	}

	function showMe(){
		if (isIE||isNN) {
			whichDog.style.visibility="visible";
			//document.email_form.template_id.style.visibility = "hidden";
			//document.email_form.GroupID.style.visibility = "hidden";
			//document.email_form.InternalGroupID.style.visibility = "hidden";
			//document.email_form.saved_video.style.visibility = "hidden";
			//document.email_form.FooterID.style.visibility = "hidden";
		}
		else if (isN4) {
			document.theLayer.visibility="show";
			//document.email_form.template_id.style.visibility = "hidden";
			//document.email_form.GroupID.style.visibility = "hidden";
			//document.email_form.InternalGroupID.style.visibility = "hidden";
			//document.email_form.saved_video.style.visibility = "hidden";
			//document.email_form.FooterID.style.visibility = "hidden";
		}else{
			whichDog.style.visibility="visible";
			//document.email_form.template_id.style.visibility = "hidden";
			//document.email_form.GroupID.style.visibility = "hidden";
			//document.email_form.InternalGroupID.style.visibility = "hidden";
			//document.email_form.saved_video.style.visibility = "hidden";
			//document.email_form.FooterID.style.visibility = "hidden";
		}
		return false;
	}

	function showMe2(){
		if (isIE||isNN) {
			whichDog.style.visibility="visible";
			//document.email_form.template_id.style.visibility = "hidden";
			document.email_form.GroupID.style.visibility = "hidden";
			document.email_form.InternalGroupID.style.visibility = "hidden";
			document.email_form.saved_video.style.visibility = "hidden";
			document.email_form.FooterID.style.visibility = "hidden";
		}
		else if (isN4) {
			document.theLayer.visibility="show";
			//document.email_form.template_id.style.visibility = "hidden";
			document.email_form.GroupID.style.visibility = "hidden";
			document.email_form.InternalGroupID.style.visibility = "hidden";
			document.email_form.saved_video.style.visibility = "hidden";
			document.email_form.FooterID.style.visibility = "hidden";
		}
	}

		function hideMe2(){
		if (isIE||isNN){
		  whichDog.style.visibility="hidden";
			//document.email_form.template_id.style.visibility = "visible";
			document.email_form.GroupID.style.visibility = "visible";
			document.email_form.InternalGroupID.style.visibility = "visible";
			document.email_form.saved_video.style.visibility = "visible";
			document.email_form.FooterID.style.visibility = "visible";
		}
		else if (isN4){
    	document.theLayer.visibility="hide";
		  //document.email_form.template_id.style.visibility = "visible";
			document.email_form.GroupID.style.visibility = "visible";
			document.email_form.InternalGroupID.style.visibility = "visible";
			document.email_form.saved_video.style.visibility = "visible";
			document.email_form.FooterID.style.visibility = "visible";
		}
	}

	document.onmousedown=ddInit;
	document.onmouseup=Function("ddEnabled=false");

/* account management scripts */

/*************** manage_company.php ***************/
function company_modify_check() {
	if (document.company_form.txtBusiness.value == "") {
		alert("You must enter a valid Business name!");
		document.company_form.reset();
	}
	else if (document.company_form.txtFirstName.value == "") {
		alert("You must enter a valid First Name!");
		document.company_form.reset();
	}
	else if (document.company_form.txtLastName.value == "") {
		alert("You musr enter a valid Last Name!");
		document.company_form.reset();
	}
	else if (document.company_form.txtPhone1.value == "") {
		alert("You must enter a Phone Number!");
		document.company_form.reset();
	}
	else if (document.company_form.txtEmail.value == "") {
		alert("You must enter a valid Email Address!");
		document.company_form.reset();
	}
	else {
		document.company_form.submit();
	}
	return;
}

/*************** manage_contacts.php ***************/
function modify_contact_check() {
	$mod = true;

	if (document.modify_contact.txtFirstName.value == "") {
		alert("You must supply a valid First Name for your contact!");
		$mod = false;
		return;
	}
	else if (document.modify_contact.txtLastName.value == "") {
		alert("You must supply a valid Last name for your contact!");
		$mod = false;
		return;
	}
	else if (document.modify_contact.txtEMail.value == "") {
		alert("You must supply a valid EMail Address for your contact!");
		$mod = false;
		return;
	}
	/* modified by balji. on 4th march 09*/
	if (document.modify_contact.txtEMail.value != "") {
	   var emailRegEx = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
       email = document.modify_contact.txtEMail.value;
      if(!email.match(emailRegEx)){
        alert("You must supply a valid EMail Address for your contact!");
		$mod = false;
		return false;
		}
	}
    /*----------------------------------*/
	if ($mod) {
		document.modify_contact.submit();
	}
}

function insert_contact_check() {
	$add = true;
	if (!document.insert_contact.cBox1.checked || !document.insert_contact.cBox2.checked || !document.insert_contact.cBox3.checked || !document.insert_contact.cBox4.checked) {
		alert ("You must first agree to the Anti-Spam policy on the right hand side.");
		$add = false;
		return false;
	}
	
	if (document.insert_contact.txtFirstName.value == "") {
		alert("You must supply a valid First Name for your contact!");
		$add = false;
		return false;
	}
	else if (document.insert_contact.txtLastName.value == "") {
		alert("You must supply a valid Last name for your contact!");
		$add = false;
		return false;
	}
	else if (document.insert_contact.txtEMail.value == "") {
		alert("You must supply a valid EMail Address for your contact!");
		$add = false;
		return false;
	}
	/* modified by balji. on 4th march 09*/
	if (document.insert_contact.txtEMail.value != "") {
	   var emailRegEx = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
       email = document.insert_contact.txtEMail.value;
      if(!email.match(emailRegEx)){
        alert("You must supply a valid EMail Address for your contact!");
		$add = false;
		return false;
		}
	}
	/*---------------------------------------*/

	if ($add) {
		document.insert_contact.submit();
	}
}

function delete_contact_check() {
	var check = confirm("Are you sure you want to delete the selected contacts?");
	if (check) {
		document.delete_contact.submit();
	}
}

/*************** manage_footers.php ***************/
function insert_footer_check() {
	$add = true;

	if (document.insert_footer.txtFooterName.value == "") {
		alert("You must supply a Footer Name!");
		$add = false;
	}
	else if (document.insert_footer.txtFooterText.value == "") {
		alert("You must Footer Text!");
		$add = false;
	}

	if ($add) {
		document.insert_footer.submit();
	}
}

/*************** manage_scripts.php **************/
function insert_script_check() {
	var add = true;

	if (document.insert_script.script_name.value == "") {
		alert("You must enter a script name");
		add = false;
	}
	else if (document.insert_script.script_text.value == "") {
		alert("You must enter a script body.");
		add = false;
	}
	if (add == true) {
		document.insert_script.submit();
	}
}

/*************** manage_groups.php ***************/
function delete_group_check(gid) {
	var check = confirm("Are you sure you want to delete this group?");
	if (!check) { return; }
	document.del_form.submit();
}
function insert_group_check() {
	if (document.add_group.txtTitle.value == "") {
		alert("You must enter a Group Title!");
	}
	else {
		document.add_group.submit();
	}
}

/*************** manage_internal_groups.php ***************/
function delete_internal_group_check(gid) {
	var check = confirm("Are you sure you want to delete this internal group?");
	if (!check) { return; }
	document.del_form.submit();
}
function insert_internal_group_check() {
	if (document.add_group.txtTitle.value == "") {
		alert("You must enter an Internal Group Title!");
	}
	else {
		document.add_group.submit();
	}
}

/*************** manage_personal.php ***************/
function update_personal_info() {
	if (document.personal_info.txtPassword.value == "") {
		alert("You must enter a valid Password!");
	}
	else if (document.personal_info.txtPasswordConfirm.value == "") {
		alert("You must enter a valid Password confirmation!");
	}
	else if (document.personal_info.txtEmail.value == "") {
		alert("You must enter a valid Email Address!");
	}
	else {
		document.personal_info.submit();
		return;
	}
	document.personal_info.reset();
}

/*************** admin_customer.php ***************/
function edit_customer_check() {
	if (document.edit_customer.txtBusiness.value == "") {
		alert("You must enter a valid Business Name!");
	}
	else if (document.edit_customer.txtFirstName.value == "") {
		alert("You must enter a valid First Name!");
	}
	else if (document.edit_customer.txtLastName.value == "") {
		alert("You must enter a valid Last Name!");
	}
	else if (document.edit_customer.txtPhone1.value == "") {
		alert("You must enter a valid Phone Number!");
	}
	else if (document.edit_customer.txtEmail.value == "") {
		alert("You must enter a valid Email Address!");
	}
	else if (document.edit_customer.txtMaxUsers.value == "") {
		alert("You must enter a Maximum Number of Minutes!");
	}
	else {
		document.edit_customer.submit();
	}
}

function delete_customer_check(cid){
	var check = confirm("Are you sure you want to cancel this account?  By doing so you will delete all account infomration including all users and videos.");
	if (check) {
		window.location = "./admin_customers.php?del=1&cid=" + cid;
	}
}

function insert_customer_check() {
	if (document.add_customer.txtBusiness.value == "") {
		alert("You must enter a valid Business Name!");
	}
	else if (document.add_customer.txtFirstName.value == "") {
		alert("You must enter a valid First Name!");
	}
	else if (document.add_customer.txtLastName.value == "") {
		alert("You must enter a valid Last Name!");
	}
	else if (document.add_customer.txtPhone1.value == "") {
		alert("You must enter a valid Phone Number!");
	}
	else if (document.add_customer.txtEmail.value == "") {
		alert("You must enter a valid Email Address!");
	}
	else if (document.add_customer.txtMaxUsers.value == "") {
		alert("You must enter a Maximum Number of Users!");
	}
	else {
		document.add_customer.submit();
	}
}

/*************** admin_sales_reps.php ***************/
function sales_rep_check() {
	if (document.new_sales.txtFirstName.value == "") {
		alert("You must enter a valid First Name!");
	}
	else if (document.new_sales.txtLastName.value == "") {
		alert("You must enter a valid Last Name!");
	}
	else if (document.new_sales.txtUsername.value == "") {
		alert("You must enter a valid Username!");
	}
	else if (document.new_sales.txtPassword.value == "") {
		alert("You must enter a valid Password!");
	}
	else if (document.new_sales.txtEmail.value == "") {
		alert("You must enter a valid Email Address!");
	}
	else if (document.new_sales.txtPhone1.value == "") {
		alert("You must enter a valid Phone Number!");
	}
	else if (document.new_sales.txtBusiness.value == "") {
		alert("You must enter a valid Business name!");
	}
	else if (document.new_sales.txtMinAllowed.value == "") {
		alert("You must enter a Maximum Number of Minutes!");
	}
	else {
		document.new_sales.submit();
	}
}

/*************** admin_tasks.php ***************/
function add_task_check() {
	if (document.add_task.txtDescription.value == "") {
		alert("You must enter a Task Description!");
	}
	else {
		document.add_task.submit();
	}
}

/*************Account managemnet******************/
function delete_user(uid) {
	var check = confirm("Are you sure you want to delete this user?");
	if (check) {
		window.location = "./manage_users.php?del=1&uid=" + uid;
	}
}

function new_user() {
	if (document.new_user.txtFirstName.value == "") {
		alert("You must enter a valid First Name!");
	}
	else if (document.new_user.txtLastName.value == "") {
		alert("You must enter a valid Last Name!");
	}
	else if (document.new_user.txtUsername.value == "") {
		alert("You must enter a valid Username!");
	}
	else if (document.new_user.txtPassword.value == "") {
		alert("You must enter a valid Password!");
	}
	else if (document.new_user.txtEmail.value == "") {
		alert("You must enter a valid Email Address!");
	}
	else if (document.new_user.txtPhone1.value == "") {
		alert("You must enter a valid Phone Number!");
	}
	else {
		document.new_user.submit();
	}
}

function update_user() {
	if (document.edit_user.txtFirstName.value == "") {
		alert("You must enter a valid First Name!");
	}
	else if (document.edit_user.txtLastName.value == "") {
		alert("You must enter a valid Last Name!");
	}
	else if (document.edit_user.txtPassword.value == "") {
		alert("You must enter a valid Password!");
	}
	else if (document.edit_user.txtEmail.value == "") {
		alert("You must enter a valid Email Address!");
	}
	else if (document.edit_user.txtPhone1.value == "") {
		alert("You must enter a valid Phone Number!");
	}
	else {
		document.edit_user.submit();
	}
}

/*************** admin_users.php ***************/
function delete_user_check(uid) {
	var check = confirm("Are you sure you want to delete this user?");
	if (check) {
		window.location = "./admin_users.php?del=1&uid=" + uid;
	}
}


function new_user_check() {
	if (document.new_user.txtFirstName.value == "") {
		alert("You must enter a valid First Name!");
	}
	else if (document.new_user.txtLastName.value == "") {
		alert("You must enter a valid Last Name!");
	}
	else if (document.new_user.txtUsername.value == "") {
		alert("You must enter a valid Username!");
	}
	else if (document.new_user.txtPassword.value == "") {
		alert("You must enter a valid Password!");
	}
	else if (document.new_user.txtEmail.value == "") {
		alert("You must enter a valid Email Address!");
	}
	else if (document.new_user.txtPhone1.value == "") {
		alert("You must enter a valid Phone Number!");
	}
	else {
		document.new_user.submit();
	}
}

function update_user_check() {
	if (document.edit_user.txtFirstName.value == "") {
		alert("You must enter a valid First Name!");
	}
	else if (document.edit_user.txtLastName.value == "") {
		alert("You must enter a valid Last Name!");
	}
	else if (document.edit_user.txtPassword.value == "") {
		alert("You must enter a valid Password!");
	}
	else if (document.edit_user.txtEmail.value == "") {
		alert("You must enter a valid Email Address!");
	}
	else if (document.edit_user.txtPhone1.value == "") {
		alert("You must enter a valid Phone Number!");
	}
	else {
		document.edit_user.submit();
	}
}

/*************** saved.php & stored.php & admin_video_table.php ***************/
function popUpLink(pid) {
	myURL = "./popups/popUpLink.php?p=" + pid;
	myWindow = window.open(myURL, "link1", "width=400, height=600, scrollbars=yes");
}
function popUpUploadedLink(pid) {
	myURL = "./popups/popUpUploadedLink.php?p=" + pid;
	myWindow = window.open(myURL, "link1", "width=400, height=400");
}
function make_perm(vid, start) {
	var check = confirm("Move this video to Stored Videos section?");
	if (check) {
		window.location = "./saved.php?start=" + start + "&mv=1&v=" + vid;
	}
}
function rename_video(vid, vname, start) {
	var old_name_encoded = escape(vname);
	var qstring = "?start=" + start + "&vid=" + vid + "&on=" + old_name_encoded;
	myURL = "./popups/popUpRename.php" + qstring;
	myWindow = window.open(myURL, "rename1", "width=400, height=200");
}
function rename_uploaded_video(vid, vname, start) {
	var old_name_encoded = escape(vname);
	var qstring = "?start=" + start + "&vid=" + vid + "&on=" + old_name_encoded;
	myURL = "./popups/popUpUploadRename.php" + qstring;
	myWindow = window.open(myURL, "rename1", "width=400, height=200");
}
function delete_video_check() {
	var check = confirm("Are you sure you want to delete the selected videos?\nIf Deleted, Any Sent Video will no longer be Viewable");
	if (check) {
		document.delete_vid.submit();
	}
}
function show_viewers(vid) {
	var w = 900;
	var h = 370;
	var top = screen.height/2 - h/2;
	var left= screen.width/2 - w/2;

	myURL = "./popups/popUpViewers.php?v=" + vid;
	myWindow = window.open(myURL, "viewers1", "width=" + w + ", height=" + h + ",left=" + left + ",top="+top+",scrollbars=yes");
}
function show_forwards(vid) {
	var w = 640;
	var h = 370;
	var top = screen.height/2 - h/2;
	var left= screen.width/2 - w/2;

	myURL = "./popups/popUpForwards.php?v=" + vid;
	myWindow = window.open(myURL, "viewers1", "width=" + w + ", height=" + h + ",left=" + left + ",top="+top+",scrollbars=yes");
}
function show_viewers_crm(vid) {
	var w = 640;
	var h = 370;
	var top = screen.height/2 - h/2;
	var left= screen.width/2 - w/2;

	myURL = "./popups/popUpCrmViewers.php?v=" + vid;
	myWindow = window.open(myURL, "viewers1", "width=" + w + ", height=" + h + ",left=" + left + ",top="+top+",scrollbars=yes");
}

function show_viewers_uploaded(vid) {
	var w = 450;
	var h = 300;
	var top = screen.height/2 - h/2;
	var left= screen.width/2 - w/2;

	myURL = "./popups/popUpUploadedViewers.php?v=" + vid;
	myWindow = window.open(myURL, "viewers1", "width=" + w + ", height=" + h + ",left=" + left + ",top="+top+",scrollbars=yes");
}
function preview_video(vid, Uflag) {
	myURL = "./popups/popUpPreview.php?v=" + vid + "&uf=" + Uflag;
	myWindow = window.open(myURL,'_getemails', 'width=1024, scrollbars=1');
}
function preview_video(vid, name, Uflag) {
	myURL = "./popups/popUpPreview.php?v=" + vid + "&uf=" + Uflag;
	myWindow = window.open(myURL, name, 'width=1024, scrollbars=1');
}
function preview_video3(vid, Uflag, DesignID, LinkID) {
	myURL = "./popups/popUpPreview.php?v=" + vid + "&uf=" + Uflag+"&u="+DesignID+"&TemplateLinks="+LinkID;
	myWindow = window.open(myURL,'_getemails', 'width=1024, scrollbars=1');
}
function preview_video4(vid, name, Uflag, DesignID, LinkID) {
	myURL = "./popups/popUpPreview.php?v=" + vid + "&uf=" + Uflag+"&u="+DesignID+"&TemplateLinks="+LinkID;
	myWindow = window.open(myURL, name, 'width=1024, scrollbars=1');
}
function preview_greenscreen_video(vid, Uflag) {
	var w = 350;
	var h = 375;
	var top = screen.height/2 - h/2;
	var left= screen.width/2 - w/2;
	var opts = "width=" + w + ",height=" + h + ",left=" + left + ",top=" + top + ",scrollbars=yes";
	myURL = "./popups/popUpGreenScreenPreview.php?v=" + vid;
	myWindow = window.open(myURL, "preview1", opts);
}
function email_video(vid, Uflag) {
	var w = 450;
	var h = 680;
	var top = screen.height/2 - h/2;
	var left = screen.width/2 - w/2;
	var opts = "width=" + w + ",height=" + h + ",left=" + left + ",top=" + top + ",scrollbars=yes";

	myURL = "./popups/popUpEmail.php?v=" + vid + "&uf=" + Uflag;
	myWindow = window.open(myURL, "email1", opts);
}
function email_uploaded_video(vid) {
	var w = 450;
	var h = 680;
	var top = screen.height/2 - h/2;
	var left = screen.width/2 - w/2;
	var opts = "width=" + w + ",height=" + h + ",left=" + left + ",top=" + top + ",scrollbars=yes";

	myURL = "./popups/popUpUploadedEmail.php?v=" + vid;
	myWindow = window.open(myURL, "email1", opts);
}
function move_to_saved(vid, start) {
	var check = confirm("Move this video to Temporary Videos section?");
	if (check) {
		window.location = "./stored.php?start=" + start + "&mv=1&v=" + vid;
	}
}
function rename_stored_video(vid, vname, start) {
	var old_name_encoded = escape(vname);
	var qstring = "?stored=1&start=" + start + "&vid=" + vid + "&on=" + old_name_encoded;
	myURL = "./popups/popUpRename.php" + qstring;
	myWindow = window.open(myURL, "rename1", "width=400, height=200");
}

/*************** signup.php ***************/
function signup_form_check() {
	if (document.signup_form.txtBusiness.value == "") {
		alert("You must enter a valid Business Name!");
	}
	else if (document.signup_form.txtFirstName.value == "") {
		alert("You must enter a valid First Name!");
	}
	else if (document.signup_form.txtLastName.value == "") {
		alert("You must enter a valid Last Name!");
	}
	else if (document.signup_form.txtUsername.value == "") {
		alert("You must enter a valid Username!");
	}
	else if (document.signup_form.txtPassword.value == "") {
		alert("You must enter a valid Password!");
	}
	else if (document.signup_form.txtPasswordConfirm.value == "") {
		alert("You must enter a valid Password Confirmation!");
	}
	else if (document.signup_form.txtPhone1.value == "") {
		alert("You must enter a valid Phone Number!");
	}
	else if (document.signup_form.txtEmail.value == "") {
		alert("You must enter a valid Email Address!");
	}
	else if (document.signup_form.txtPassword.value != document.signup_form.txtPasswordConfirm.value) {
		alert("Your Password and Password Confirm values must match!");
		document.signup_form.txtPassword.value = "";
		document.signup_form.txtPasswordConfirm.value = "";
	}
	else if (document.signup_form.txtAgree.value != "true") {
		alert("You must agree to the Terms and Conditions!");
	}
	else {
		var check = confirm("Are you sure the values you have entered are correct?");
		if (check) {
			document.signup_form.submit();
		}
	}
}

function popup_terms() {
	var w = 600;
	var h = 600;
	var top = screen.height/2 - h/2;
	var left= screen.width/2 - w/2;
	var opts = "width=" + w + ",height=" + h + ",left=" + left + ",top=" + top + ",scrollbars=yes";

	myURL = "terms.php";
	myWindow = window.open(myURL, "preview1", opts);

}

function popup_sales_terms() {
	var w = 600;
	var h = 600;
	var top = screen.height/2 - h/2;
	var left= screen.width/2 - w/2;
	var opts = "width=" + w + ",height=" + h + ",left=" + left + ",top=" + top + ",scrollbars=yes";

	myURL = "terms_sales.php";
	myWindow = window.open(myURL, "preview1", opts);
}

/*************** record.php ***************/
function record_preview_video(vid) {
	var w = 370;
	var h = 325;
	var top = screen.height/2 - h/2;
	var left= screen.width/2 - w/2;
	var opts = "width=" + w + ",height=" + h + ",left=" + left + ",top=" + top + ",scrollbars=yes";

	myURL = "./preview_video.php?v=" + vid;
	myWindow = window.open(myURL, "preview1", opts);
}


/***************  admin_script_management.php *********************/
function insert_script_check() {
	if (document.add_script.txtScriptName.value == "") {
		alert("You must enter a valid Script Name!");
	}
	else if (document.add_script.txtScriptBody.value == "") {
		alert("You must enter a valid Script Body!");
	}
	else {
		document.add_script.submit();
	}
}


/***************  Manage Viewers *********************/
function delete_viewer_check() {
	var check = confirm("Are you sure you want to delete the selected viewers?");
	if (check) {
		document.delete_viewers.submit();
	}
}

/*************** Admin Stats *************************/
function popup_contact_info(cid) {
	var w = 400;
	var h = 400;
	var top = screen.height/2 - h/2;
	var left= screen.width/2 - w/2;
	var opts = "width=" + w + ",height=" + h + ",left=" + left + ",top=" + top + ",scrollbars=yes";

	//myURL = "terms_sales.php";
	myURL = "popups/popUpContactInfo.php?cid=" + cid;
	myWindow = window.open(myURL, "preview1", opts);
}
/************** VirtualRep **********************/
function place_call(id) {
	var w = 400;
	var h = 500;
	var top = screen.height/2 - h/2;
	var left = screen.width/2 - w/2;
	var opts = "width=" + w + ",height=" + h + ",left=" + left + ",top=" + top + ",scrollbars=yes, status=no";


	myURL = "./virtual_rep/place_call.php?id=" + id;
	callWindow = window.open(myURL, "call_window", opts);
}
