﻿function insertQVideoFlash_callback(pid, vid){
  var embed_code = "<iframe style='WIDTH: 400px; HEIGHT: 400px' src='http://api.youku.com/api_show4partner/pid_" + pid + "/id_" + vid + ".html' id='youku_api_show4partner' frameborder='0' scrolling='no'></iframe>";
  return embed_code.toString();
}

function NeatDialog(sHTML, sTitle, bCancel)
{  
  window.neatDialog = null;

  this.elt = null;
  if (document.createElement  &&  document.getElementById)
  {
    var dg = document.createElement("div");
    dg.id = "neat-dialog";
    dg.className = "neat-dialog";
    if (sTitle)
      sHTML = "<div class='neat-dialog-title'><span>"+sTitle+"</span>"+
              ((bCancel) ? "<a href='#' onclick='postBack();javascript:window.neatDialog.close();'><img border='0' src='http://editlet.youku.com/alt_images/cancel.gif' alt='Cancel' class='nd-cancel'></a>" : "") + "<div style='clear:both;'></div></div>\n" + sHTML;
    dg.style.visibility = "hidden";
    dg.innerHTML = sHTML;

    var dbg = document.createElement("div");
    dbg.id = "nd-bdg";
    dbg.className = "neat-dialog-bg";

    var dgc = document.createElement("div");
    dgc.id = "neat-dialog-cont";
    dgc.className = "neat-dialog-cont";
   
    //adjust positioning if body has a margin
    if (document.body.offsetLeft > 0)
        dgc.style.marginLeft = document.body.offsetLeft + "px";
        
    dgc.appendChild(dbg);
    dgc.appendChild(dg);
    document.body.appendChild(dgc);
    dbg.style.height = document.body.scrollHeight + "px";
    dbg.style.width = document.body.scrollWidth + "px";
    var W = dg.scrollWidth;
    if(dg.outerWidth != null){W = dg.outerWidth + 2;}
    var H = dg.scrollHeight;
    dg.style.width = dg.firstChild.style.width = W + "px";
    
    setInterval(function(){	
        var posTop = (document.body.clientHeight - H)>0? parseInt((document.body.clientHeight - H)/2):0;
        var posLeft = (document.body.clientWidth - W)>0? parseInt((document.body.clientWidth - W)/2):0;	
        dg.style.top = posTop;
	// Youku Editlet-Dialog Position Customization (Updated By Stone Shen 2007-10-09)
	dg.style.top = 120; // Since Embed-Code4Partner Used IFrame, We Must Lock The DIV-Dialog Top-Postion Now.
        dg.style.left = posLeft;
	dbg.style.height = document.body.scrollHeight + "px";
	dbg.style.width = document.body.scrollWidth + "px";
        if(dg.style.visibility == "hidden"){dg.style.visibility = "visible";}
   },20)

    this.elt = dgc;
    window.neatDialog = this;		
  }
}

NeatDialog.prototype.close = function()
{
  if (this.elt)
  {
    this.elt.style.display = "none";
    this.elt.parentNode.removeChild(this.elt);
  }
  window.neatDialog = null;
}

function UploadFile(fileMode, scene, category, cookieName, creator, ids, title)
{
  var sHTML = '<iframe src="http://myclub.foloda.com/Publishes/ClubFileUpload.aspx?fileMode='+fileMode+'&Scene='+scene+'&Category='+category+'&CookieName='+cookieName+'&Creator='+creator+'&ids='+ids+'&title='+title+'" id="mainwin" name="mainwin" width="680" height="300" frameborder="0" scrolling="no"></iframe>';
    var sTitle = '<b>上传图片</b>';
    var bCancel = true;
    new NeatDialog(sHTML, sTitle, true);
}



function GetObj(objName){
 if(document.getElementById){
  return eval('document.getElementById("' + objName + '")');
 }else if(document.layers){
  return eval("document.layers['" + objName +"']");
 }else{
  return eval('document.all.' + objName);
 }
}
function RadioCheck(parentid,sender) {
 var d= GetObj(parentid);
 for(i=0;i<d.getElementsByTagName("input").length;i++)
 {
 if(d.getElementsByTagName("input")[i].type=="radio"){
    d.getElementsByTagName("input")[i].checked="";
    }
 }
 sender.checked="checked";
}



