﻿// For Huggies Logon Module ================

function frm_logon_user_CopyHref(hrefInfo) {

    var txt = hrefInfo;
    copyToClipboard(txt);
    alert("复制成功！");
}

function copyToClipboard(txt) {
    if (window.clipboardData) {
        window.clipboardData.clearData();
        window.clipboardData.setData("Text", txt);
    }
}



function frm_logon_user_forgetpassword() {
    window.open("/cds/expmyp/register.aspx", "_self");
}


function frm_logon_user_logout()
{
  //alert('logout');
  $("#frm_logon_action")[0].value = "logout";
  $("#frm_logon").submit();
}



function frm_logon_user_logon()
{
  //alert('logon');
  //alert($("#frm_logon_username")[0].value);
  $("#frm_logon").submit();
}

// For Huggies Comment Module ================

function frm_comment_delete(comment_id)
{
  //alert('logon');
  if (comment_id.length > 0)
  {
    $("#frm_comment_action")[0].value = "delete";
    $("#frm_comment_id")[0].value = comment_id;
    $("#frm_comment").submit();  
  }
}


//  2009-10-19
/*AJAX Request Object*/
function createXHR(){
	var xhr =false;
	if(window.XMLHttpRequest){
		xhr = new XMLHttpRequest();
	}else if(window.ActiveXObject){
		try{
			xhr = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e1){
			try{
				xhr = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(e2){
				alert(e2);
			}
			
		}
	}
	return xhr;
}
	 
function frm_comment_add()
{//2009-10-19    
	  
var code = $("#frm_comment_vco")[0].value; 
 var vco1 = $("#vco")[0].value;
     if(vco1==""){
       alert("请输入验证码！");
       return  false;
     } 
    if(code!=vco1){
     alert("验证码不正确，请重新输入！");
           return false ;
    }
  if ($("#frm_comment_textarea")[0].value.length > 0)
  {
    $("#frm_comment_action")[0].value = "add";
    $("#frm_comment_content")[0].value = $("#frm_comment_textarea")[0].value;
    $("#frm_comment").submit();
  }
}

function frm_comment_reply(comment_id)
{
  var commentOwnerId = "#a_comment_owner" + comment_id;
  $("#frm_comment_textarea")[0].value = "回复" + $(commentOwnerId).text() + ":";
  $("#frm_comment_textarea").focus();
}


function frm_comment_quote(comment_id)
{
  var commentOwnerId = "#a_comment_owner" + comment_id;
  var commentDateId = "#a_comment_date" + comment_id;
  var commentContentId = "#a_comment_content" + comment_id;  
  $("#frm_comment_textarea")[0].value = 
    "“引用 " 
    + $(commentOwnerId).text()
    + " "
    + $(commentDateId).text() 
    + "说: "
    + $(commentContentId).text()
    +"”";
  $("#frm_comment_textarea").focus();
}


// For Huggies Scores List ================

function frm_scorelist_gotopage(num_page)
{

  $("#frm_scorelist_goto_page")[0].value = num_page;
  $("#frm_scorelist").submit();
}


function frm_scorelist_nextpage()
{

  var current_page = ($("#frm_scorelist_goto_page")[0].value) * 1;
  var last_page = ($("#frm_scorelist_last_page")[0].value) * 1;
  var next_page = current_page + 1;
  if ( parseInt(next_page) > parseInt(last_page))
    next_page = last_page;
  $("#frm_scorelist_goto_page")[0].value = next_page;
  $("#frm_scorelist").submit();
}


function frm_scorelist_lastpage()
{

  var current_page = $("#frm_scorelist_goto_page")[0].value;
  var last_page = $("#frm_scorelist_last_page")[0].value;

  $("#frm_scorelist_goto_page")[0].value = last_page;
  $("#frm_scorelist").submit();
}

