﻿/*History*/
//添加了修改updateState标识操作 dgq 20090220

function _CHKTZCOUNTUP_(evt,tshowId,maxtextCount)
{
    if ( evt == null )
        evt = window.event;
 if ( this.value.length >= maxtextCount )
 { 
  this.value=this.value.substr(0,maxtextCount);
   /*
     //event.returnValue = false;
     // return false;  */
 }
    var sc = document.getElementById(tshowId); 
    sc.innerHTML = this.value.length+ "/" + maxtextCount; 
    sc.style.textAlign="left";
   this.onblur=function()
   {
     sc.innerHTML =""; 
   }
   /*
    //var sc = document.getElementById(tshowId);
   // sc.innerHTML = this.value.length + 1 + "/" + maxtextCount; 
   */
  
}

function updateImage(imageurl)
{
    document.getElementById(imgshow).src = "/GetArtmywayPreviewDesign.ashx?it=small&seed="+imageurl+"&"+Math.random();
}

function getinputControlsValue()
{
    var x = new Array();
    for ( var i = 0 ; i < inputControls.length ; i++ )
    {
        var dd = document.getElementById(inputControls[i]);
        x[i] = dd.value;
    }
    return x;
}

function updateTemplate(evt)
{ 
    showLoading();
   
    if(AjaxPro)
    {
      AjaxPro.timeoutPeriod=120*1000;
    }
    designGuid=PreviewImageSeed;
    
    //begin 修改updateState标识 dgq 20090220
    SetTrue();
    //end 修改updateState标识 dgq 20090220
    
    Artmyway.ComposeDesign(Sku,getinputControlsValue(),PreviewImageSeed,callback_updateTemplate);   
    
    if ( evt == null )
        evt = window.event;
                
    evt.returnValue = false;
    return false;
}

function callback_updateTemplate(res)
{
    if ( res.value )
    {
        updateImage(PreviewImageSeed);        
      //  hideLoading();        
    }
    else
    {
        startup();
    }
}

function showLoading()
{  
       document.getElementById(imgshow).src="/images/artmyway_images/loading.gif";
}

function hideLoading()
{}


function startup()
{
  document.getElementById(imgshow).src = "/webshowimage.ashx?sku="+Sku+"&foldername=" + foldername + "&" + Math.random();
}
function onover(obj)
{
  obj.className="tags_changecolor";
  obj.onmouseout=function(){
  obj.className="tags_yuanse";
  }
}
  
function displayNewWindow()
{
    ShipWindow=window.open('','ShipTime','height=270,width=430,resizable=yes,top=100,left=100');
    var htmlcontent = ShipWindow.document;
    htmlcontent.write('<html>');
    htmlcontent.write('<head><title>Details</title></head>');
    htmlcontent.write('<body>');
    htmlcontent.write('<font style="font-family:Verdana;font-size:12px; line-height:120%;">');
    htmlcontent.write('<p><strong><u>Shipping  details (free over $99)</u></strong></p>');
    htmlcontent.write('<p>Free Standard Shipping on purchases of  $99.00 or more.</p>');
    htmlcontent.write('<p>Standard Shipping $6.95 (5-7 business days)<br />');
    htmlcontent.write('Expedited Shipping $19.95 (2-4 business  days)<br />');
    htmlcontent.write('Rush Shipping $39.95 (1-2 business days)</p>');
    htmlcontent.write('<p>*The above rates and delivery times are  within the Continental US.</p></font>');
    htmlcontent.write('</body></html>');
    htmlcontent.close();
}