function allCheckOn(){			
	$("input:checkbox[class='report']").attr('checked', true);
}

function allCheckOff(){
	$("input:checkbox[class='report']").attr('checked', false);
}

function newOpen(url,w_name, w,h){

	saveReportNo();
	
	strId = $.cookie('cookiename');
	
	$("input:checkbox[class='report']").attr('checked', false);
	if(strId === '' || strId === 'null'){
		return;
	}
	document.form1.submit3.value = '1';
	w = window.open("", w_name, "width=" + w + ", height="+ h + ", toolbar=no, menubar=no, location=no, scrollbars=yes, resize=yes");
	w.onLoad = newAction(url, w_name);
}

function newAction(actionname, winname){
	document.form1.target = winname;
	document.form1.action = actionname;
	document.form1.submit();
	document.form1.submit3.value = '';
	document.form1.target = '';
}

function saveReportNo(){

	strId = '';
	
	strId = $.cookie('cookiename');
	
	strId = strId + '';
	for (var i=0; i<$('.report').length; i++) {
		id = $('.report').eq(i).attr('name').substring(15);
		id = id.substring(0,id.length - 1);
	
		if($('.report').eq(i).attr('checked')){
			if(-1 === strId.indexOf('"'+id+'"',0)){
				if(strId === ''){
					strId = '"' + id + '"';
				}else{
					strId = strId + ',' + '"' + id + '"';
				}
			}
		}else{
			if(-1 !== strId.indexOf('"'+id+'"',0)){
				cindex = strId.indexOf(",",0);
				if(-1 !== strId.indexOf(",",0)){
					if(-1 !== strId.indexOf('"'+id+'"',cindex)){
						strId = strId.replace('",'+id+'"','');
					}else{
						strId = strId.replace('"'+id+'",','');
					}
				}else{
					strId = strId.replace('"'+id+'"','');
				}
			}
		}
	}
	
	if(-1 !== strId.indexOf('null,',0)){
		strId = strId.replace('null,','');
	}
	
	$.cookie('cookiename',strId,{ expires: 7 , path: '/admin_articles/index/'});
}

function newOpenF(url,w_name, w,h){

	saveReportNoF();
	
	strId = $.cookie('reportid');
	
	$("input:checkbox[class='report']").attr('checked', false);
	if(strId === '' || strId === 'null'){
		return;
	}
	document.form1.submit3.value = '1';
	
	w = window.open("", w_name, "width=" + w + ", height="+ h + ", toolbar=no, menubar=no, location=no, scrollbars=yes, resize=yes");
	w.onLoad = newAction(url, w_name);
}

function saveReportNoF(){

	strId = '';
	
	strId = $.cookie('reportid');
	
	strId = strId + '';
	for (var i=0; i<$('.report').length; i++) {
		id = $('.report').eq(i).attr('name').substring(15);
		id = id.substring(0,id.length - 1);
	
		if($('.report').eq(i).attr('checked')){
			if(-1 === strId.indexOf('"'+id+'"',0)){
				if(strId === ''){
					strId = '"' + id + '"';
				}else{
					strId = strId + ',' + '"' + id + '"';
				}
			}
		}else{
			if(-1 !== strId.indexOf('"'+id+'"',0)){
				cindex = strId.indexOf(",",0);
				if(-1 !== strId.indexOf(",",0)){
					if(-1 !== strId.indexOf('"'+id+'"',cindex)){
						strId = strId.replace('",'+id+'"','');
					}else{
						strId = strId.replace('"'+id+'",','');
					}
				}else{
					strId = strId.replace('"'+id+'"','');
				}
			}
		}
	}
	
	if(-1 !== strId.indexOf('null,',0)){
		strId = strId.replace('null,','');
	}
	
	$.cookie('reportid',strId,{ expires: 7 , path: '/articles/index/'});
}
