function setPointer(theRow, theAction, theDefaultColor, thePointerColor, theMarkColor)
{
    var theCells = null;
    

    // 1. Pointer and mark feature are disabled or the browser can't get the
    //    row -> exits
    if ((thePointerColor == '' && theMarkColor == '')
        || typeof(theRow.style) == 'undefined') {
        return false;
    }

    // 2. Gets the current row and exits if the browser can't get it
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }

    // 3. Gets the current color...
    var rowCellsCnt  = theCells.length;
    var domDetect    = null;
    var currentColor = null;
    var newColor     = null;
    // 3.1 ... with DOM compatible browsers except Opera that does not return
    //         valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        //currentColor = "#cccccc";
        
        domDetect    = true;
        //alert( currentColor+"aaa" );
    }
    // 3.2 ... with other browsers
    else {
        currentColor = theCells[0].style.backgroundColor;
        domDetect    = false;
        
    } // end 3

    // 4. Defines the new color
    // 4.1 Current color is the default one
    
    if (currentColor == ''
        || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
        if (theAction == 'over' && thePointerColor != '') {
            newColor = thePointerColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor = theMarkColor;
        }
    }
    // 4.1.2 Current color is the pointer one
    else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()) {
        if (theAction == 'out') {
            newColor = theDefaultColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor = theMarkColor;
        }
    }
    // 4.1.3 Current color is the marker one
    else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) {
        if (theAction == 'click') {
            newColor = (thePointerColor != '')
                     ? thePointerColor
                     : theDefaultColor;
        }
    } // end 4

    // 5. Sets the new color...
    if (newColor) {
        var c = null;
        // 5.1 ... with DOM compatible browsers except Opera
        if (domDetect) {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].setAttribute('bgcolor', newColor, 0);
            } // end for
        }
        // 5.2 ... with other browsers
        else {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].style.backgroundColor = newColor;
            }
        }
    } // end 5

    return true;
} // end of the 'setPointer()' function

function page_change(obj,page,id_rub){
	var objPageNum = obj;
	var value = objPageNum.options[objPageNum.selectedIndex].value;
	document.location = "spip.php?page="+ page +'&'+ id_rub +'&start_num=' + value +'&var_mode=recalcul';
}

function image_change( id ){
	for( var i=1;i<5;i++ ){
		if( document.getElementById( "feature_image_"+i ) ){
			if( i == id ){
				document.getElementById( "feature_image_"+i ).style.display = "block";
			}else{
				document.getElementById( "feature_image_"+i ).style.display = "none";
			}
		}
	}
}

function movie_draw( num ){
	if( $( "#movie_item_"+num ).attr("src") == "images/star/star2.png" ){
		for( var i=0;i<=num;i++ ){
			$( "#movie_item_"+i ).attr("src","images/star/star1.png");
		}
	}

	tmp = num+1;
	for( k=tmp ;k<10;k++ ){
		$( "#movie_item_"+k ).attr("src","images/star/star2.png");
	}

	for( var j=0;j<=10;j++ ){
		if( j == num ){
			document.getElementById( "dis_"+j ).style.display = "block";
		}else{
			document.getElementById( "dis_"+j ).style.display = "none";
		}
	}
}

function movie_draw_init( num ){
	for( var k=0 ;k<10;k++ ){
		$( "#movie_item_"+k ).attr("src","images/star/star2.png");
	}

	for( var j=0;j<=10;j++ ){
		if( j == 10 ){
			document.getElementById( "dis_"+j ).style.display = "block";
		}else{
			document.getElementById( "dis_"+j ).style.display = "none";
		}
	}
}

function add_result( id_art,mark ){
	mark = mark+1;
	$.ajax({
    type: "POST",
    url: "spip.php?page=inc_score_ajax",
    data:   "id_art="+id_art+"&mark="+mark,
    success: function( text ){ 
		alert( "评分成功！" );
		$( "#result" ).empty();  
		$( "#result" ).html( text );
    }
	});
}

function blog_login_check( uid ){
	if( uid == '' ){
		alert( '你还没有登陆,请登陆 ! ' );
		return false;
	}else{
		return true;
	}
}

function set_color( id,type ){
	if( type == 1 ){
		document.getElementById( id ).style.color = "#AD362B";
	}else{
		document.getElementById( id ).style.color = "#AD362B";
	}
}

function isEmail(str) {
  // are regular expressions supported?
  var supported = 0;
  if (window.RegExp) {
    var tempStr = "a";
    var tempReg = new RegExp(tempStr);
    if (tempReg.test(tempStr)) supported = 1;
  }
  if (!supported) 
    return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
  return (!r1.test(str) && r2.test(str));
}
