function checkEmptyField(field) {
	var value1=field.value.toString();
	value1=value1.replace(/(^\s*)|(\s*$)/g, "");
	if (value1 == "" || value1.length < 1 ) {
		field.focus();
		field.select();
		field.value=value1;
		return false;
	}else{
		return true;
	}
}

function checkEmail(field) {
	var email_string=field.value;
	var reMail;
	reMail = /^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\.[a-z]{2,4}$/;
	if (!email_string.match(reMail)) {
		field.focus();
		field.select();
		return false;
	}
}

var checkflag = "false";
function check_uncheck_all(field) {
	if (checkflag == "false") {
		for (i = 0; i < field.length; i++) {
			field[i].checked = true;}
			checkflag = "true";
		return true; }
		else {
		for (i = 0; i < field.length; i++) {
			field[i].checked = false; }
			checkflag = "false";
		return true; }
}


function invertAllcheckbox(group){
for(var i = 0;i <group.length;i++){
group[i].checked = group[i].checked ? false : true;
}
}


function show_hide_block(a) {
	obj=document.getElementById(a);
	if (obj.style.display=='none') {
		obj.style.display='block';
	}else{
		obj.style.display='none';
		}
}


function selectAll(selectBox,selectAll) {
	// have we been passed an ID
	if (typeof selectBox == "string") {
		selectBox = document.getElementById(selectBox);
	}
	// is the select box a multiple select box?
	if (selectBox.type == "select-multiple") {
		for (var i = 0; i < selectBox.options.length; i++) {
			selectBox.options[i].selected = selectAll;
		}
	}
}

function inverseAll(selectBox) {
	// have we been passed an ID
	if (typeof selectBox == "string") {
		selectBox = document.getElementById(selectBox);
	}
	// is the select box a multiple select box?
	if (selectBox.type == "select-multiple") {
for (var i = 0; i < selectBox.options.length; i++) {
    if (selectBox.options[i].selected == true) {
      selectBox.options[i].selected = false;
    }else{
		selectBox.options[i].selected = true;
		}
}
	}
}




function CenterDiv2(divobj){ //Centers a div element on the page

 var divobj = document.getElementById(divobj);

 standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body; //create reference to common "body" across doctypes
 scrollbarwidth = 16;
 ie=document.all && !window.opera;
 dom=document.getElementById;
 scroll_top=(ie)? standardbody.scrollTop : window.pageYOffset;
 scroll_left=(ie)? standardbody.scrollLeft : window.pageXOffset;
 docwidth=(ie)? standardbody.clientWidth : window.innerWidth-scrollbarwidth;
 docheight=(ie)? standardbody.clientHeight: window.innerHeight;
 docheightcomplete=(standardbody.offsetHeight>standardbody.scrollHeight)? standardbody.offsetHeight : standardbody.scrollHeight ;//Full scroll height of document
 objwidth=divobj.offsetWidth; //width of div element
 objheight=divobj.offsetHeight; //height of div element
 topposition=(docheight>objheight)? scroll_top+docheight/2-objheight/2+"px" : scroll_top+10+"px"; //Vertical position of div element: Either centered, or if element height larger than viewpoint height, 10px from top of viewpoint

divobj.style.left = docwidth/2-objwidth/2+"px"; //Center div element horizontally
divobj.style.top = Math.floor(parseInt(topposition))+"px";
divobj.style.visibility = "visible";

}

function SellerEnabledWarning(bb){

	hidden_div1=document.getElementById('seller_enabled_div');
	hidden_div2=document.getElementById('seller_reject_div');	
	
	if (bb=='1'){
		//alert("If you enable the seller all sample pictures will be deleted.");
		hidden_div1.style.display='block';
		hidden_div2.style.display='none';
	}

	if (bb=='0'){
		hidden_div1.style.display='none';
		hidden_div2.style.display='block';
	}
}

var ChangeStatusMessage='\n\n\nNEW: all billing and buyer info related to this picture will be nullified;\n\nAPPROVED: all billing and buyer info related to this picture will be nullified;\nthe picture will be put up for sale;\n\nSOLD: status will be set to SOLD, no info will be written to the billing.';

