// JavaScript Document
	function highlight_row(id, highlight) {
			var row= document.getElementById(id);
			if((typeof(row) == 'object') || (typeof(row) == 'function')) {
				if(highlight == true) {
					for(var i= 0; i < row.cells.length; i++) {
						row.cells[i].style.color= '#ffffff';
						row.cells[i].style.backgroundColor= '#770000';
					}
				}
				else {
					for(var i= 0; i < row.cells.length; i++) {
						row.cells[i].style.color= '';
						row.cells[i].style.backgroundColor= '';
					}
				}
			}
		}

	function validEmail(email, type)
	{
	  if (type == 'sms') {	
	  	email_regular_expression=new RegExp("^@([-!#\$%&'*+/0-9=?A-Z^_`a-z{|}~ ]+\\.)+[a-zA-Z]{2,5}\$");
	  }  else {
	  	email_regular_expression=new RegExp("^([-!#\$%&'*+./0-9=?A-Z^_`a-z{|}~ ])+@([-!#\$%&'*+/0-9=?A-Z^_`a-z{|}~ ]+\\.)+[a-zA-Z]{2,5}\$");   // email_regular_expression= '^.+@.+\\..+$';  // simple one
	  }
	  return email_regular_expression.test(email);
	}
	
	function change_vis(elem_id, visible) {
		if(document.user_form.elements['user_type_f'].value > 1) {
			document.getElementById(elem_id).style.visibility= "visible";
		}
		else {
			document.getElementById(elem_id).style.visibility= "hidden";
		}
	}
	
	function expandSection(element, sectionName) {
		if(document.getElementById(sectionName)) {
			var expand= element.getAttribute('expand');
			//alert(expand);
			if(expand == '') {
				document.getElementById(sectionName).style.display= '';
				expand= 'expand';
			}
			else {
				document.getElementById(sectionName).style.display= 'none';
				expand= '';
			}
			
			element.setAttribute('expand', expand);
			return true;
		}
		return false;
	}
	
	
	function expandSection2(element, sectionName,script_url,scipt_flg) {
		
		if(document.getElementById(sectionName)) {
			if ($.cookie('opt_groups['+script_url+']['+sectionName+']')=='1'){
				element.setAttribute('expand', '');
			}
			var expand= element.getAttribute('expand');
			
			
			//alert(expand);
			if (scipt_flg==''){
				if(expand == '') {
					//document.getElementById(sectionName).style.display= '';
					$("#"+sectionName).hide();
					document.getElementById('gh_header_descr_'+sectionName).innerHTML = 'Click here to see your choices';
					expand= 'expand';
					$.cookie('opt_groups['+script_url+']['+sectionName+']', 0);
				}
				else {
					//document.getElementById(sectionName).style.display= 'none';
					document.getElementById('gh_header_descr_'+sectionName).innerHTML = 'Click here to close your choices';
					$("#"+sectionName).show();
					expand= '';
					$.cookie('opt_groups['+script_url+']['+sectionName+']', 1);
				}
				element.setAttribute('expand', expand);
			}else{
				if(expand == '') {
					document.getElementById('gh_header_descr_'+sectionName).innerHTML = 'Click here to close your choices';
					$("#"+sectionName).show();
				}else{
					$("#"+sectionName).hide();
					document.getElementById('gh_header_descr_'+sectionName).innerHTML = 'Click here to see your choices';
				}
			}
		}
		
		return false;
	}
	
	function submitmenu(context, method){
		if(context != '') {
			document.https_topmenu.actioncontext.value="page="+context;
			document.https_topmenu.submit();
		}
		return false;
	}
	
	function getHelpPopup(id) {
		window.open('?ap=help&at=show-'+id, '_blank', 'left=400, top=250, height=300, width=500, menubar=no, toolbar=no, location=no, resizable=yes, scrollbars=yes');
	}
	function getHelpPopup_q(id) {
		window.open('?ap=help&at=show-'+id+'&type=quest', '_blank', 'left=400, top=250, height=300, width=500, menubar=no, toolbar=no, location=no, resizable=yes, scrollbars=yes');
	}
	function getPublHelpPopup(id) {
		window.open('index.php?ap=help&at=show-'+id, '_blank', 'left=400, top=250, height=300, width=500, menubar=no, toolbar=no, location=no, resizable=yes, scrollbars=yes');
	}
	function getHelpPopup_agr(id) {
		window.open('?ap=help&at=show-'+id+'&type=agr', '_blank', 'left=400, top=250, height=300, width=500, menubar=no, toolbar=no, location=no, resizable=yes, scrollbars=yes');
	}
	
	function getHelpPopup_acc(id) {
		window.open('?ap=help&at=show-'+id+'&type=acc', '_blank', 'left=400, top=250, height=300, width=500, menubar=no, toolbar=no, location=no, resizable=yes, scrollbars=yes');
	}
	
	function getHelpPopup_whyrecommended_acc(id) {
		window.open('?ap=help&at=show-'+id+'&type=why_rec', '_blank', 'left=400, top=250, height=300, width=500, menubar=no, toolbar=no, location=no, resizable=yes, scrollbars=yes');
	}
	
	/*
	function prnt_getHelpPopup_agr(id) {
		var wnd = window.open('?ap=help&at=show-'+id+'&type=agr', '_blank', 'left=400, top=250, height=300, width=500, menubar=no, toolbar=no, location=no, resizable=yes, scrollbars=yes');
			wnd.onload = function(){
				wnd.print();
			}
	}
	*/
	
	function display_GroupOptions(gr_id){
		window.open('?ap=admin//DATABASE/optiongroups&act=show_options&gr_id='+gr_id, '_blank', 'left=400, top=250, height=400, width=500, menubar=no, toolbar=no, location=no, resizable=no, scrollbars=yes');
	}
	
	function display_Importfm(bl_id,current_area){
		window.open('?ap=admin//CMS/blockeditor&act=displ_import_fm&bl_id='+bl_id+'&cur_area='+current_area, '_blank', 'left=500, top=250, height=250, width=320, menubar=no, toolbar=no, location=no, resizable=no, scrollbars=no');	
	}
		
	/*	
	function display_CheckOrder(){
		window.open('?ap=cart&act=show_checkorder', '_blank','width=700, menubar=no, toolbar=no, location=no, resizable=yes, scrollbars=yes');
	}	
	*/
	//function display_covers(act){
	//	window.open('?ap=authorcenter8&todo=display_covers&act='+act, '_blank','menubar=no, toolbar=no, location=no, resizable=yes, scrollbars=yes');					
	//}
	function fupload_handler(val,form_object) {
		var upl_img = form_object.name+'_upl_img';
		var upl_err_box = form_object.name+'_err_box';
		document.getElementById(upl_img).style.display='none';
		
		// check server response
		if(val=='succ_upload'){
			$("#"+upl_err_box).css("color",'green');
			if (form_object.name=='uf1'){	// if it is an Author uploader photo
				$("#"+upl_err_box).text('File Uploaded Successfully!  Multiple authors?  You can upload up to 3 author photos.');
			}else{
				$("#"+upl_err_box).text('File uploaded successfully!');
			}
			$("#"+upl_err_box).fadeIn(800);
			if (document.getElementById('author_uploads_list')){
				get_upl_f_table();
			}
		}else{
			if (val.length>1000){	// if session expired
				document.location.href="./authors.php";
				return false;
			}else{ 
				$("#"+upl_err_box).css("color",'red');
				$("#"+upl_err_box).text(val);
				$("#"+upl_err_box).fadeIn(800);
			}
		}
	}	

	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	