if( typeof(Box) == 'undefinded' || typeof(Box) != 'function' ){
    //No se declara dos veces
    var Box = function()
    {
        this.keys = new Array();
        this.box = new Array();
        this.html = new Array();
        this.htmlcc = new Array();
        this.htmladsl = new Array();
        this.htmlsms = new Array();
        this.html803 = new Array();
        this.htmllog = new Array();
    }
	
	Box.prototype = {
		setKey : function(hash)
		{
		    this.keys[this.keys.length]=hash;
		},
		//Se setea el objeto PaymentBox en el siguiente espacio del box
		setBox : function(box_object)
		{
		    this.box[this.getKey()] = box_object;
		},
		//Se setea el objeto PaymentBoxHTML en el siguiente espacio del html
		setHTML : function(html_object)
		{
		    this.html[this.getKey()] = html_object;
		},
		//Se setea el objeto PaymentBoxHTMLCC en el siguiente espacio del htmlcc
		setHTMLCC : function(html_object)
		{
		    this.htmlcc[this.getKey()] = html_object;
		},
		//Se setea el objeto PaymentBoxHTMLADSL en el siguiente espacio del htmladsl
		setHTMLADSL : function(html_object)
		{
		    this.htmladsl[this.getKey()] = html_object;
		},
		//Se setea el objeto PaymentBoxHTMLSMS en el siguiente espacio del htmlsms
		setHTMLSMS : function(html_object)
		{
		    this.htmlsms[this.getKey()] = html_object;
		},
		//Se setea el objeto PaymentBoxHTML803 en el siguiente espacio del html803
		setHTML803 : function(html_object)
		{
		    this.html803[this.getKey()] = html_object;
		},
		//Se setea el objeto PaymentBoxHTMLLOG en el siguiente espacio del htmllog
		setHTMLLOG : function(html_object)
		{
		    this.htmllog[this.getKey()] = html_object;
		},
		getKey : function(id)
		{
		    if(id == null ) id = this.keys.length-1;
		    return this.keys[id];
		},
		getBox : function(hash)
		{
		    if(hash == null ) hash = this.getKey();
		    return this.box[hash];
		},
		getHTML : function(hash)
		{
		    if(hash == null ) {
		      hash = this.getKey();
		    }
		    return this.html[hash];
		},
		getHTMLCC : function(hash)
		{
		    if(hash == null ) hash = this.getKey();
		    return this.htmlcc[hash];
		},
		getHTMLADSL : function(hash)
		{
		    if(hash == null ) hash = this.getKey();
		    return this.htmladsl[hash];
		},
		getHTMLSMS : function(hash)
		{
		    if(hash == null ) hash = this.getKey();
		    return this.htmlsms[hash];
		},
		getHTML803 : function(hash)
		{
		    if(hash == null ) hash = this.getKey();
		    return this.html803[hash];
		},
		getHTMLLOG : function(hash)
		{
		    if(hash == null ) hash = this.getKey();
		    return this.htmllog[hash];
		},
		
		
		//Se calcula la posicion del lightbox
		getScrollXY : function()
		{
		  var scrOfX = 0, scrOfY = 0;heightOf = 0;widthOf = 0;
		  if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		    //DOM compliant
		    scrOfY = document.body.scrollTop;
		    scrOfX = document.body.scrollLeft;
		  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		    //IE6 standards compliant mode
		    scrOfY = document.documentElement.scrollTop;
		    scrOfX = document.documentElement.scrollLeft;
		  }
		  if( typeof( window.innerWidth ) == 'number' ) {
		    //Non-IE
		    widthOf = window.innerWidth;
		    heightOf = window.innerHeight;
		  }else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		    //IE 6+ in 'standards compliant mode'
		    widthOf = document.documentElement.clientWidth;
		    heightOf = document.documentElement.clientHeight;
		  }else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		    //IE 4 compatible
		    widthOf = document.body.clientWidth;
		    heightOf = document.body.clientHeight;
		  }
		  return [ scrOfX, scrOfY, widthOf, heightOf];
		},
		
		//Se oculta el lightbox
		hideLightbox : function(id)
		{
		    if(!id || !document.getElementById('box_'+id) ) id = payment.getKey();
		    var box = document.getElementById('box_'+id);
		    if( box ){
		        box.style.display='none';
		    }
		}
	}
	
    if (typeof(showPaymentLightbox) == 'undefined') {
      function showPaymentLightbox(__identifier){
        if (typeof(__identifier) != 'undefined') {
          eval('a' + __identifier + 'showPaymentLightbox();');
        } else if (typeof(showV1PaymentLightbox) != 'undefined') {
          showV1PaymentLightbox(__identifier);
        }
      }
    }
    
    function showV1PaymentLightbox(__identifier) {
      if (typeof(aa266a66212ee723b81485f577dac311dshowPaymentLightbox) != 'undefined') {
        aa266a66212ee723b81485f577dac311dshowPaymentLightbox(__identifier);
      }
    }
    //Se muestra y posiciona el lightbox , esta funcion esta fuera de la clase
    function aa266a66212ee723b81485f577dac311dshowPaymentLightbox(id)
    {
        if( typeof(payment) != 'undefinded'){
            if(!id || !document.getElementById('box_'+id) ) id = payment.getKey();
            var key = 'box_'+id;
            var box = document.getElementById(key);
            if( box ){
                var newpos = payment.getScrollXY();
                //alert(newpos+' '+box.clientHeight+' '+box.clientWidth);
                var height_box = (box.clientHeight == 0 )? 505 : box.clientHeight;
                var width_box = (box.clientWidth == 0 )? 547 : box.clientWidth;
                lightBoxNewYPos = (newpos[3] - height_box)/2;//newpos[1]
                lightBoxNewXPos = (newpos[2] - width_box)/2;//newpos[0]
                var browser=navigator.appName;
                var version=parseFloat(navigator.appVersion);
                if (browser=="Microsoft Internet Explorer" && version>=4){
                    box.style.display='block';
                    box.style.zIndex = 10001;
                    box.style.position='absolute';
                    box.style.top = lightBoxNewYPos+newpos[1];
                    box.style.left = lightBoxNewXPos;
                    window.onscroll = function (e) {
                        var newposi = payment.getScrollXY();
                        var height_box = (box.clientHeight == 0 )? 505 : box.clientHeight;
                        box.style.top = newposi[1]+ (newposi[3] - height_box)/2;
                    }
                }else{
                   box.setAttribute('style', 'position: fixed;z-index: 10001;top:'+lightBoxNewYPos+'px;left:'+lightBoxNewXPos+'px;');
                }
            }
        }
    }
    //Se declara la variable global payment
    var payment = new Box();
}
//Se setea un el numero de box cada vez que se incluye esta clase
payment.setKey('a266a66212ee723b81485f577dac311d');

var PaymentBox = function()
{
    this.initialize();
}

PaymentBox.prototype = {
	// Sets
	setPromoContent : function(promo)
	{
	    this.promo_content = promo;
	},
	setIdContainer : function(idcontainer)
	{
	    this.idcontainer = idcontainer;
	},
	setQueryString : function(query_string)
	{
	    this.query_string = query_string;
	},
	setMethods : function(methods)
	{
	    this.methods = methods;
	},
	setStyleSite : function(style)
	{
	    this.style_site = style;
	},
	setSkin : function(skin)
	{
	    this.skin = skin;
	},
	setShowLightbox : function(flag)
	{
	    this.show_lightbox = flag;
	},
	setIsSpa : function(flag)
	{
	    this.is_spa = flag;
	},
	setSmsAccess : function(sms_option)
	{
	    if( sms_option ) this.sms_option = sms_option;
	},
	setBorderSize : function(border_size)
	{
	    if( border_size ) this.border_size = border_size;
	},
	setBackgroundColor : function(background_color)
	{
	    if( background_color ) this.background_color = background_color;
	},
	setTextColor : function(text_color)
	{
	    if( text_color ) this.text_color = text_color;
	},
	setLinkColor : function(link_color)
	{
	    if( link_color ) this.link_color = link_color;
	},
	setHighlightColor : function(highlight_color)
	{
	    if( highlight_color ) this.highlight_color = highlight_color;
	},
	setBorderColor : function(border_color)
	{
	    if( border_color ) this.border_color = border_color;
	},
	setButtonColor : function(button_color)
	{
	    if( button_color ) this.button_color = button_color;
	},
	setButtonTextColor : function(button_text_color)
	{
	    if( button_text_color ) this.button_text_color = button_text_color;
	},
	setFontSize : function(font_size)
	{
	    if( font_size ) this.font_size = font_size;
	},
	setShowTitle : function(show)
	{
	    this.show_title = show;
	},
	setWidthBox : function(width)
	{
	    if( width ) this.width_box = width;
	},
	setFontFamily : function(font_family)
	{
	    if( font_family ) this.font_family = font_family;
	},
	
	setPaymentOptions : function(payment_options)
	{
	    this.payment_options = payment_options;
	},
	
	// Gets
	getPromoContent : function()
	{
	    return this.promo_content;
	},
	getIdContainer : function()
	{
	    return this.idcontainer;
	},
	getQueryString : function()
	{
	    return this.query_string;
	},
	getMethods : function()
	{
	    return this.methods;
	},
	getStyleSite : function()
	{
	    return this.style_site;
	},
	getSkin : function()
	{
	    if( typeof(this.skin) == 'undefined' || this.skin == ' ' ) this.skin = false;
	    return this.skin;
	},
	getShowLightbox : function()
	{
	    return this.show_lightbox;
	},
	getIsSpa : function()
	{
	    return this.is_spa;
	},
	getSmsAccess : function(sms_option)
	{
	    if( typeof(this.sms_option) == 'undefined' || this.sms_option == ' ' ) this.sms_option = 'espia';
	    return this.sms_option;
	},
	getBorderSize : function()
	{
	    if( typeof(this.border_size) == 'undefined' || this.border_size == ' ' ) this.border_size = 0;
	    return this.border_size;
	},
	getBackgroundColor : function()
	{
	    if( typeof(this.background_color) == 'undefined' || this.background_color == ' ' ) this.background_color = false;
	    return this.background_color;
	},
	getTextColor : function()
	{
	    if( typeof(this.text_color) == 'undefined' || this.text_color == ' ' ) this.text_color = false;
	    return this.text_color;
	},
	getLinkColor : function()
	{
	    if( typeof(this.link_color) == 'undefined' || this.link_color == ' ' ) this.link_color = false;
	    return this.link_color;
	},
	getHighlightColor : function()
	{
	    if( typeof(this.highlight_color) == 'undefined' || this.highlight_color == ' ' ) this.highlight_color = false;
	    return this.highlight_color;
	},
	getBorderColor : function()
	{
	    if( typeof(this.border_color) == 'undefined' || this.border_color == ' ' ) this.border_color = false;
	    return this.border_color;
	},
	getButtonColor : function()
	{
	    if( typeof(this.button_color) == 'undefined' || this.button_color == ' ' ) this.button_color = false;
	    return this.button_color;
	},
	getButtonTextColor : function()
	{
	    if( typeof(this.button_text_color) == 'undefined' || this.button_text_color == ' ' ) this.button_text_color = false;
	    return this.button_text_color;
	},
	getFontSize : function()
	{
	    if( typeof(this.font_size) == 'undefined' || this.font_size == ' ' ) this.font_size = false;
	    return this.font_size;
	},
	getShowTitle : function()
	{
	    if( typeof(this.show_title) == 'undefined' || this.show_title == ' ' ) this.show_title = false;
	    return this.show_title;
	},
	getWidthBox : function()
	{
	    if( typeof(this.width_box) == 'undefined' || this.width_box == ' ' ) this.width_box = false;
	    return this.width_box;
	},
	getFontFamily : function()
	{
	    if( typeof(this.font_family) == 'undefined' || this.font_family == ' ' ) this.font_family = false;
	    return this.font_family;
	},
	getPaymentOptions : function()
	{
	    return this.payment_options;
	},
	initialize : function()
	{
	    // Style
	    {
	        this.font_family = new Array("Lucida Grande", "Lucida Sans Unicode", "Helvetica", "Arial");
	        this.methods = new Array("cc");
	        this.show_lightbox = true;
	        this.is_spa = false;
	        this.font_size = 13;
	        this.show_title = true;
	        this.background_color='transparent';
	        this.border_size = 0;
	        this.promo_content='video';
	        this.sms_option = 'espia';
	    }
	}
}

//Se setea un nuevo box cada vez que se incluye esta clase
payment.setBox( new PaymentBox());

var PaymentBoxHTML = function(pb)
{
    this.pb = pb;
}
PaymentBoxHTML.prototype.getHeadersHTML = function()
{
    return document.createElement('div');
}
PaymentBoxHTML.prototype.getLoadFlag = function()
{
    return this.flag_load;
}
PaymentBoxHTML.prototype.setLoadFlag = function(valor)
{
    this.flag_load = valor;
}
PaymentBoxHTML.prototype.getGlobalHTML = function(log)
{
    var clas = 'spc_paybox spc_main_bg spc_main_primary_text';
    if( this.pb.getShowLightbox() ) clas +=' spc_lightbox spcContainer';
    if( this.pb.getShowLightbox() && this.pb.getPromoContent() == 'adult' && !log ) clas +=' spc_am_lightbox';
    var div_global = this.getDivHTML(this.pb.getIdContainer(),clas,null);
    var styles = new Array();
    var styleCounter = 0;
    styles[styleCounter++] = "border: "+this.pb.getBorderSize()+"px solid";
    if( this.pb.getBorderColor()) {
      div_global.style.borderColor = this.pb.getBorderColor();
      styles[styleCounter++] = 'border-color:' + this.pb.getBorderColor();
    }
    div_global.setAttribute('border',this.pb.getBorderSize()+"px solid");
    if( this.pb.getWidthBox() ) {
      div_global.style.width = this.pb.getWidthBox();
      styles[styleCounter++] = 'width:' + this.pb.getWidthBox() + 'px';
    }
    if( this.pb.getTextColor() ){
        div_global.style.color = this.pb.getTextColor();
        styles[styleCounter++] = 'color:' + this.pb.getTextColor();
    }
    if( this.pb.getBackgroundColor() ){
        if( !this.pb.getSkin() || (this.pb.getSkin() && this.pb.getBackgroundColor()!='transparent') ){
            if( this.pb.getShowLightbox() && this.pb.getBackgroundColor()!='transparent' || !this.pb.getShowLightbox()){
                div_global.style.backgroundColor = this.pb.getBackgroundColor();
                styles[styleCounter++] = 'background-color:' + this.pb.getBackgroundColor();
            }else if(this.pb.getShowLightbox()){
                div_global.style.backgroundColor ='#FFFFFF';
                styles[styleCounter++] = 'background-color:#FFFFFF';
            }
        }
    }
    if( this.pb.getFontFamily() ){
        div_global.style.fontFamily = this.pb.getFontFamily().join(',');
        styles[styleCounter++] = 'font-family:' + this.pb.getFontFamily().join(',');
    }
    div_global.setAttribute('style',styles.join(';'));
    if( this.pb.getFontSize() ) this.createCSSStyle(this.pb.getFontSize(),div_global);
    div_global.style.borderWidth = this.pb.getBorderSize();
    return div_global;
}
PaymentBoxHTML.prototype.getTitleHTML = function(text)
{
    return this.getDivHTML('spc_title','spc_title main_primary_text',text);
}
PaymentBoxHTML.prototype.getSubTitleHTML = function(t1,t2,t3)
{
    var ds = this.getDivHTML( 'spc_subtitle' , 'spc_subtitle  main_primary_text' , t1);
    ds.appendChild(this.getSpanHTML(t2,'spc_main_highlight',true));
    ds.innerHTML += t3;
    return ds;
}
PaymentBoxHTML.prototype.getTagFormHTML = function(id,m,a)
{
    if( !id ) id = 'spc_form';
    var f = document.createElement('form');
    f.setAttribute('id', id);
    f.setAttribute('name', 'spc_form');
    f.setAttribute('method', m);
    f.setAttribute('action', a);
    return f;
}
PaymentBoxHTML.prototype.getTableHTML = function(id,c,o)
{
    var t = document.createElement('table');
    if( !id ) id = 'spc_table';
    if( id != '' ) t.setAttribute('id', id);
    if( !c ) c = 'spc_table';
    if( c != '' ) t.setAttribute('class', c);
    if( o ) t.setAttribute('onclick', o);
    return t;
}
//Se calcula el color opaco en base al bg
PaymentBoxHTML.prototype.getResaltHTML = function(htmlobject)
{
    if( typeof(this.pb.getBackgroundColor() != 'undefined')  && this.pb.getBackgroundColor() ){
        var color_bg = this.pb.getBackgroundColor();
        if( color_bg != 'transparent'){
            var R = parseInt(color_bg.substring(1,3),16);
            if( R == 0 ){
                R+= 60;
            }else{
                R-= 20;
            }
            var G = parseInt(color_bg.substring(3,5),16);
            if( G == 0 ){
                G+= 60;
            }else{
                G-= 20;
            }
            var B = parseInt(color_bg.substring(5,7),16);
            if( B == 0 ){
                B+= 60;
            }else{
                B-= 20;
            }
            var colorR ='';
            if (isNaN(R)){
                colorR =  "00";
            }else if (R <= 0 ){
                colorR =  "00";
            }else if (R > 255){
                colorR = "FF";
            }
            colorR = (colorR =='')? "0123456789ABCDEF".charAt((R - R % 16)/16) + "0123456789ABCDEF".charAt(R % 16) : colorR ;
            var colorG =  '';
            if (isNaN(G)){
                colorG =  "00";
            }else if (G <= 0 ){
                colorG =  "00";
            }else if (G > 255){
                colorG = "FF";
            }
            colorG = (colorG =='')? "0123456789ABCDEF".charAt((G - G % 16)/16) + "0123456789ABCDEF".charAt(G % 16) : colorG ;
            var colorB =  '';
            if (isNaN(B)){
                colorB =  "00";
            }else if (B <= 0 ){
                colorB =  "00";
            }else if (B > 255){
                colorB = "FF";
            }
            colorB = (colorB =='')? "0123456789ABCDEF".charAt((B - B % 16)/16) + "0123456789ABCDEF".charAt(B % 16) : colorB ;

            var color = colorR + colorG + colorB;
        }else{
            var color = 'EEEEEE';
        }
        if(htmlobject){
            htmlobject.style.backgroundColor ="#" + color;
        }else{
            return "#"+color;
        }
    }else{
        return false;
    }
}
PaymentBoxHTML.prototype.getMenuHTML = function(m,id)
{
    var mt = this.pb.getMethods();
    var ul = document.createElement('ul');
    if( mt && mt.length > 1 ){
        var resalt_color = this.getResaltHTML();
        ul.setAttribute('class', 'spc_tabs');
        if( resalt_color && !this.pb.getSkin()) ul.style.borderBottomColor=resalt_color;
        ul.style.borderBottomStyle="solid";
        ul.style.borderBottomWidth="1px";
        if(payment.getHTML(id).getLoadFlag()){
            if(navigator.appName == "Microsoft Internet Explorer")  ul.style.height="auto";
        }else{
            payment.getHTML(id).setLoadFlag(true);
        }
        var tags = new Array();
        tags['cc'] = 'Credit Card';
        tags['adsl'] = 'ADSL';
        tags['sms'] = 'SMS';
        tags['803'] = 'Phone';
        for (var i=0; i< mt.length; i++){
            var li = document.createElement('li');
            li.setAttribute('id', 'title_'+mt[i]);
            li.setAttribute('onclick' , "payment.getHTML"+mt[i].toUpperCase()+"('"+id+"').drawBox(document.getElementById('box_"+id+"'),'"+id+"');");
            if( tags[mt[i]] ){
                li.innerHTML = tags[mt[i]];
            }else{
                li.innerHTML = mt[i].toUpperCase();
            }
            if( mt[i] == m ){
                if( typeof(this.pb.getBackgroundColor() != 'undefined') ) li.style.backgroundColor = this.pb.getBackgroundColor();
                li.setAttribute('class', 'spc_active');
                var nom = navigator.appName;
                li.style.borderWidth="1px";
                li.style.borderStyle="solid";
                if( resalt_color && !this.pb.getSkin()) li.style.borderColor = resalt_color;
                li.style.borderBottomColor='';
                li.style.borderBottomStyle='';
                li.style.borderBottomWidth='';
            }else{
                this.getResaltHTML(li);
            }
            ul.appendChild(li);
        }
        ul.appendChild(this.getDivHTML(null,"spc_clear",null,null));
    }
    return ul;
}
PaymentBoxHTML.prototype.getCodigoHTML = function(id,t,ty,v)
{
    if(!ty) ty='text';
    var tr = document.createElement('tr');
        var td = document.createElement('td');
        td.setAttribute('class', 'spc_first_col');
        td.innerHTML = t;
    tr.appendChild(td);
        var td = document.createElement('td');
            var inp = this.getInputHTML(id,'code',ty,'spc_textbox','',null);
            if(v) inp.setAttribute('value',v);
        td.appendChild(inp);
    tr.appendChild(td);
    return tr;
}
PaymentBoxHTML.prototype.getButtonHTML = function(t,cl,fl)
{
    var tr = document.createElement('tr');
        var td = document.createElement('td');
    tr.appendChild(td);
        var td = document.createElement('td');
            var tb = document.createElement('table');
            var tb = this.getTableHTML( null , 'spc_button', (cl)? cl : 'document.getElementById(\'spc_form\').submit()');
            tb.setAttribute('cellspacing', '0');
            tb.setAttribute('border', '0');
                if(fl){
                    tb.setAttribute('align', 'center');
                }else{
                    tb.setAttribute('align', 'left');
                }
                var tr_1 = document.createElement('tr');
                    var td_1 = document.createElement('td');
                    td_1.setAttribute('class', 'spc_bl');
                    if( this.pb.getButtonColor() ){
                        if (navigator.appName.indexOf("Explorer") != -1) td_1.setAttribute('style', 'background-color:'+ this.pb.getButtonColor() +';');
                        td_1.style.backgroundColor = this.pb.getButtonColor();
                    }
                tr_1.appendChild(td_1);
                    var td_2 = document.createElement('td');
                    td_2.setAttribute('class', 'spc_button_bg');
                    var ieStyle = '';
                    if( this.pb.getButtonColor() ){
                        if (navigator.appName.indexOf("Explorer") != -1) ieStyle += 'background-color:'+ this.pb.getButtonColor() +';';
                        td_2.style.backgroundColor = this.pb.getButtonColor();
                    }
                    if( this.pb.getButtonTextColor() ){
                        if (navigator.appName.indexOf("Explorer") != -1) ieStyle += 'color:'+ this.pb.getButtonTextColor()+';';
                        td_2.style.color = this.pb.getButtonTextColor();
                    }
                    if (navigator.appName.indexOf("Explorer") != -1) td_2.setAttribute('style', ieStyle);
                    td_2.innerHTML= t;
                tr_1.appendChild(td_2);
                    var td_3 = document.createElement('td');
                    td_3.setAttribute('class', 'spc_br');
                    if( this.pb.getButtonColor() ){
                        if (navigator.appName.indexOf("Explorer") != -1) td_3.setAttribute('style', 'background-color:'+ this.pb.getButtonColor()+';');
                        td_3.style.backgroundColor = this.pb.getButtonColor();
                    }
                tr_1.appendChild(td_3);
            tb.appendChild(tr_1);
        td.appendChild(tb);
    tr.appendChild(td);
    if(fl) tr=tb;
    return tr;
}
PaymentBoxHTML.prototype.getInputHTML = function(id,n,ty,c,v,s,ck)
{
    if (navigator.appName.indexOf("Explorer") != -1){
        var ids = ( id )? 'id='+id : '';
        var types = ( ty )? 'type="'+ty+'"' : 'type="hidden"';
        var names = ( n )? 'name="'+n+'"' : '';
        var clases = ( c )? 'class="'+c+'"' : '';
        var values = ( v )? 'value="'+v+'"' : '';
        var styles = ( s )? 'style="'+s+'"' :'';
        var checkes = ( ck )? 'checked="checked"' :'';
        var inp = document.createElement('<input '+ids+' '+clases+' '+values+' '+types+' '+names+' '+styles+' '+checkes+' >');
    }else{
        var inp = document.createElement('input');
        if( id ) inp.setAttribute('id', id );
        if( ty ) inp.setAttribute('type', ty );
        if( n ) inp.setAttribute('name', n );
        if( c ) inp.setAttribute('class', c );
        if( v ) inp.setAttribute('value', v );
        if( s ) inp.setAttribute('style', s );
        if( ck ) inp.setAttribute('checked', 'checked' );
    }
    return inp;
}
PaymentBoxHTML.prototype.getDivHTML = function(id,c,t,s)
{
    var div = document.createElement('div');
    if( id ) div.setAttribute('id', id );
    if( c ) div.setAttribute('class', c );
    if( s ) div.setAttribute('style', s );
    if( t ) div.innerHTML = t;
    return div;
}
PaymentBoxHTML.prototype.getImgHTML = function(id,src,c,s)
{
    var img = document.createElement('img');
    if( id ) img.setAttribute('id', id );
    if( c ) img.setAttribute('class', c );
    if( src ) img.setAttribute('src', src );
    if( s ) img.setAttribute('style', s );
    return img;
}
PaymentBoxHTML.prototype.getLinkHTML = function(id,c,t,s,hr)
{
    var l = document.createElement('a');
    if( id ) l.setAttribute('id', id);
    if( c ) l.setAttribute('class', c);
    if( t ) l.innerHTML = t;
    if( s ) l.setAttribute('style', s);
    if( hr ) l.setAttribute('href',hr);
    if( this.pb.getLinkColor() ) l.style.color = this.pb.getLinkColor();
    return l;
}
PaymentBoxHTML.prototype.getHiddenHTML = function(id,n,v)
{
    return this.getInputHTML(id,n,'hidden',null,v,null);
}
PaymentBoxHTML.prototype.getSpanHTML = function( t , c , fl )
{
    var s = document.createElement('span');
    s.setAttribute('class', c);
    s.innerHTML = t;
    if( !fl && this.pb.getBackgroundColor() ) s.style.backgroundColor = this.pb.getBackgroundColor();
    if( fl && this.pb.getHighlightColor() ) s.style.color = this.pb.getHighlightColor();
    return s;
}
PaymentBoxHTML.prototype.getLightboxButton = function( id , fl )
{
    var div = this.getDivHTML( null , null , null , null);
    div.appendChild(this.getLinkHTML('leight_'+id,'spc_main_link main_link','Continuar navegando', null,'javascript:payment.hideLightbox(\''+id+'\');'));
    div.style.margin='0px 30px 20px 140px';
    return div;
}
PaymentBoxHTML.prototype.getLightboxClose = function( id , fl )
{
    var div = this.getDivHTML(null,'spc_close_button',null,null);
    div.setAttribute('onclick',"javascript:payment.hideLightbox('"+id+"');");
    return div;
}
PaymentBoxHTML.prototype.getFooterHTML = function(t,l,lt,fl)
{
    var td = document.createElement('td');
    td.innerHTML = t ;
        if(!fl) l += '&'+this.pb.getQueryString();
        var l1 = this.getLinkHTML(null,'spc_main_link main_link',lt,null,l );
        if( fl && fl!='log' || !fl){
            l1.target='_blank';
        }
        if( fl && fl == 'log' ){
            l1.setAttribute('href',"#");
            l1.setAttribute('onclick',l+";return false;" );
        }
    td.appendChild(l1);
    return td.innerHTML;
}
PaymentBoxHTML.prototype.createCSSStyleSheet = function( id , url )
{
    var newSS = document.createElement('link');
    newSS.rel = 'stylesheet';
    newSS.setAttribute('type','text/css');
    if( id ) newSS.setAttribute('id',id );
    newSS.href = url;
    document.getElementsByTagName("head")[0].appendChild(newSS);
}
PaymentBoxHTML.prototype.createScript = function( id , url )
{
try{    var newS = document.createElement('script');
    if( document.getElementById(id) ) document.getElementsByTagName("head")[0].removeChild(document.getElementById(id));
    if( id ) newS.setAttribute('id',id );
    newS.setAttribute('type','text/javascript');
    newS.setAttribute('src',url);
    document.getElementsByTagName("head")[0].appendChild(newS);
    //if (navigator.appName.indexOf("Explorer") == -1) document.getElementsByTagName("head")[0].removeChild(newS);
}catch(e){alert(e);}
}
PaymentBoxHTML.prototype.createCSSStyle = function( size , object )
{
    var fontSize = 'font-size:'+size+'px';
    var color = !(this.pb.getSkin() || this.pb.getTextColor()) ? 'color:#000000;' : '';

    if (navigator.appName == "Microsoft Internet Explorer"){
        var newSS = document.createElement('<style type="text/css"> .spc_paybox * { '+fontSize+' '+color+' } </style>');
        document.getElementsByTagName("head")[0].appendChild(newSS);
    }else if(navigator.userAgent.lastIndexOf('Safari') == -1){
        var newSS = document.createElement('style');
        newSS.setAttribute('type','text/css');
        newSS.innerHTML='.spc_paybox * { '+fontSize+' '+color+' }';
        object.appendChild(newSS);
    }
}

PaymentBoxHTML.prototype.drawBox = function(htmlobject)
{
    var style_base = 'http://paymentbox.spacash.com/css/payments/paybox_tool_base.css';
    var style_color = 'http://paymentbox.spacash.com/css/payments/paybox_tool_color.css';
    var style_promo = ( typeof(this.pb.getStyleSite()) != 'undefined' )? this.pb.getStyleSite() : '';
    var style_skin = ( this.pb.getSkin() )? this.pb.getSkin() : '';
    if(document.getElementById("payment_box_style_base")){
        if(document.getElementById("payment_box_style_base").href == style_base){
            style_base = '';
        }
    }
    if(document.getElementById("payment_box_skin_user")){
        document.getElementsByTagName("head")[0].removeChild(document.getElementById('payment_box_skin_user'));
    }
    if(document.getElementById("payment_box_style_color")){
        document.getElementsByTagName("head")[0].removeChild(document.getElementById('payment_box_style_color'));
    }
    if(document.getElementById("payment_box_promo_color")){
        document.getElementsByTagName("head")[0].removeChild(document.getElementById('payment_box_promo_color'));
    }
    if( style_base != '' ) this.createCSSStyleSheet( 'payment_box_style_base' , style_base );
    if( style_color != '' && style_skin == '' ) this.createCSSStyleSheet( 'payment_box_style_color' , style_color);
    if( style_promo != '' && style_skin == '' ) this.createCSSStyleSheet( 'payment_box_promo_color' , style_promo);
    if( style_skin != '' ) this.createCSSStyleSheet( 'payment_box_skin_user' , style_skin);
    var box = this.pb.getIdContainer();
    payment.getHTML(box).setLoadFlag(false);
    var div_temp = document.createElement('div');
    var content_box = this.getDivHTML( 'box_'+box, null , null , (payment.getBox(box).getShowLightbox())? 'display:none;': null);
    if ( this.pb.getMethods() ){
        var methods = this.pb.getMethods();
        var method = methods[0];
        if( method == 'cc' ){
            content_box.innerHTML = payment.getHTMLCC(box).getFormHTML(box);
        }else if( method == 'adsl' ){
            content_box.innerHTML = payment.getHTMLADSL(box).getFormHTML(box);
        }else if( method == 'sms' ){
            content_box.innerHTML = payment.getHTMLSMS(box).getFormHTML(box);
        }else if( method == '803' ){
            content_box.innerHTML = payment.getHTML803(box).getFormHTML(box);
        }
    }
    
    if( payment.getBox(box).getShowLightbox() ) {
      content_box.style.display = 'none';
    }

    div_temp.appendChild(content_box);
    if ( typeof(htmlobject) != 'undefined' && htmlobject ){
        htmlobject.innerHTML = div_temp.innerHTML;
    }else{
        return div_temp.innerHTML;
    }
}
//Se setea un nuevo boxhtml cada vez que se incluye esta clase
payment.setHTML( new PaymentBoxHTML(payment.getBox(payment.getKey())));

var PaymentBoxCCHTML = function(pbh)
{
    this.pbh = pbh;
    this.form_user = false;
    this.form_pass = false;
    this.form_mail = false;
}
PaymentBoxCCHTML.prototype.setBoxCC = function(objec)
{
    this.boxCC=objec;
}
PaymentBoxCCHTML.prototype.getBoxCC = function()
{
    return this.boxCC;
}
PaymentBoxCCHTML.prototype.getUserHTML = function(id,t,p)
{
    var n = ( p =='local' || p =='adult')? 'user' : 'login';
    var tr = document.createElement('tr');
        var td = document.createElement('td');
        td.setAttribute('class', 'spc_first');
        var label = document.createElement('label');
        label.setAttribute('for', 'user');
        label.innerHTML = t;
        td.appendChild(label);
    tr.appendChild(td);
        var td = document.createElement('td');
            var inp = this.pbh.getInputHTML('user',n,'text','spc_little_textbox',null,null);
            inp.setAttribute('onkeypress', 'this.style.backgroundColor = "#FFFFFF";');
            inp.setAttribute('onblur', 'if(this.value==""){this.style.backgroundColor = "#FF0000";payment.getHTMLCC(\''+id+'\').form_user=false;}else{ payment.getHTMLCC(\''+id+'\').form_user=true;}');
        td.appendChild(inp);
    tr.appendChild(td);
    return tr;
}
PaymentBoxCCHTML.prototype.getSoyUserHTML = function(id,t,p)
{
    var tr = document.createElement('tr');
        var td = document.createElement('td');
        td.setAttribute('class', 'spc_first');
            var label = document.createElement('label');
            label.innerHTML = t;
        td.appendChild(label);
    tr.appendChild(td);
        var td = document.createElement('td');
        if(p=='adult'){
                var label = document.createElement('label');

                label.setAttribute('for', 'gender1');
                    var inp = this.pbh.getInputHTML('gender1','gender','radio','spc_radio','m',null,true);
                    inp.setAttribute('checked', 'checked');
                label.appendChild(inp);
                label.innerHTML += ''+'&nbsp;&nbsp;';//Hombre
            td.appendChild(label);
                var label = document.createElement('label');
                label.setAttribute('for', 'gender2');
                    var inp = this.pbh.getInputHTML('gender2','gender','radio','spc_radio','f',null);
                label.appendChild(inp);
                label.innerHTML += ''+'&nbsp;&nbsp;';//Mujer
            td.appendChild(label);
                var label = document.createElement('label');
                label.setAttribute('for', 'gender3');
                    var inp = this.pbh.getInputHTML('gender3','gender','radio','spc_radio','t',null);
                label.appendChild(inp);
                label.innerHTML += ''+'&nbsp;&nbsp;';//Travesti
            td.appendChild(label);
                var label = document.createElement('label');
                label.setAttribute('for', 'gender4');
                    var inp = this.pbh.getInputHTML('gender4','gender','radio','spc_radio','p',null);
                label.appendChild(inp);
                label.innerHTML += ''+'&nbsp;&nbsp;';//Pareja
            td.appendChild(label);
        }else{
            var sel = document.createElement('select');
                sel.setAttribute('id','soy_'+id);
                sel.setAttribute('name','gender');
                sel.setAttribute('class','spc_select_month');
                    var opt = document.createElement('option');
                    opt.setAttribute('value','m');
                    opt.innerHTML='';//Hombre
                sel.appendChild(opt);
                    var opt = document.createElement('option');
                    opt.setAttribute('value','f');
                    opt.innerHTML='';//Mujer
                sel.appendChild(opt);
            td.appendChild(sel);
            td.innerHTML+='';
            var sel = document.createElement('select');
                sel.setAttribute('id','busco_'+id);
                sel.setAttribute('name','interest');
                sel.setAttribute('class','spc_select_month');
                    var opt = document.createElement('option');
                    opt.setAttribute('value','m');
                    opt.innerHTML='';//Hombre
                sel.appendChild(opt);
                    var opt = document.createElement('option');
                    opt.setAttribute('value','f');
                    opt.setAttribute('selected','selected');
                    opt.innerHTML='';//Mujer
                sel.appendChild(opt);
             td.appendChild(sel);
        }
    tr.appendChild(td);
    return tr;
}
PaymentBoxCCHTML.prototype.getInteresHTML = function(id,t,p)
{
    var type = ( p !='adult' )? 'radio' : 'checkbox';
    var name = ( p !='adult' )? 'interest' : null;
    var tr = document.createElement('tr');
        var td = document.createElement('td');
        td.setAttribute('class', 'spc_first');
            var label = document.createElement('label');
            label.innerHTML = t;
        td.appendChild(label);
    tr.appendChild(td);
        var td = document.createElement('td');
            var label = document.createElement('label');
            label.setAttribute('for', 'interest1');
                var inp = this.pbh.getInputHTML('interest1',name,type,'spc_radio','m',null);
                if( p =='adult' ) inp.setAttribute('onclick', 'payment.getHTMLCC(\''+id+'\').addInteresHTML(\''+id+'\',this.checked,this.value);');
            label.appendChild(inp);
            label.innerHTML += ''+'&nbsp;&nbsp;';//Hombre
        td.appendChild(label);
            var label = document.createElement('label');
            label.setAttribute('for', 'interest2');
                var inp = this.pbh.getInputHTML('interest2',name,type,'spc_radio','f',null,true);
                if( p =='adult' ) inp.setAttribute('onclick', 'payment.getHTMLCC(\''+id+'\').addInteresHTML(\''+id+'\',this.checked,this.value);');
                inp.setAttribute('checked', 'checked');
            label.appendChild(inp);
            label.innerHTML += ''+'&nbsp;&nbsp;';//Mujer
        td.appendChild(label);
        if(p=='adult'){
                var label = document.createElement('label');
                label.setAttribute('for', 'interest3');
                    var inp = this.pbh.getInputHTML('interest3',name,type,'spc_radio','t',null);
                    if( p =='adult' ) inp.setAttribute('onclick', 'payment.getHTMLCC(\''+id+'\').addInteresHTML(\''+id+'\',this.checked,this.value);');
                label.appendChild(inp);
                label.innerHTML += ''+'&nbsp;&nbsp;';//Travesti
            td.appendChild(label);
                var label = document.createElement('label');
                label.setAttribute('for', 'interest4');
                    var inp = this.pbh.getInputHTML('interest4',name,type,'spc_radio','p',null);
                    if( p =='adult' ) inp.setAttribute('onclick', 'payment.getHTMLCC(\''+id+'\').addInteresHTML(\''+id+'\',this.checked,this.value);');
                label.appendChild(inp);
                label.innerHTML += ''+'&nbsp;&nbsp;';//Pareja
            td.appendChild(label);
        }
    tr.appendChild(td);
    return tr;
}
PaymentBoxCCHTML.prototype.getDateHTML = function(id,t,dia,mes,anio)
{
   // if( dia.lenght < 2 ) dia = '0'+dia;
   // if( mes.lenght < 2 ) mes = '0'+mes;
    var tr = document.createElement('tr');
        var td = document.createElement('td');
        td.setAttribute('class', 'spc_first');
        var label = document.createElement('label');
        label.innerHTML = t;
        td.appendChild(label);
    tr.appendChild(td);
    var td = document.createElement('td');
        var sel = document.createElement('select');
            sel.setAttribute('id','dia_'+id);
            sel.setAttribute('class','spc_select_day');
            sel.setAttribute('onchange','payment.getHTMLCC(\''+id+'\').addDateHTML(\''+id+'\');' );
            var opt = document.createElement('option');
            opt.setAttribute('value','');
            opt.innerHTML=dia;
            sel.appendChild(opt);
            for(var i=1;i < 32;i++){
                var op = document.createElement('option');
                var dia = i;
                if( dia < 10 ) dia = '0'+dia;
                op.setAttribute('value',dia);
                op.innerHTML=dia;
                sel.appendChild(op);
            }
        td.appendChild(sel);
        var sel = document.createElement('select');
            sel.setAttribute('id','mes_'+id);
            sel.setAttribute('class','spc_select_month');
            sel.setAttribute('onchange','payment.getHTMLCC(\''+id+'\').addDateHTML(\''+id+'\');' );
            var temp = mes.split(",");
            for(var i=0;i < temp.length;i++){
                var op = document.createElement('option');
                var mes = i;
                if( mes < 10 ) mes = '0'+mes;
                op.setAttribute('value',(i==0)? '': mes );
                op.innerHTML=temp[i];
                sel.appendChild(op);
            }
        td.appendChild(sel);
        var sel = document.createElement('select');
            sel.setAttribute('id','anio_'+id);
            sel.setAttribute('class','spc_select_year');
            sel.setAttribute('onchange','payment.getHTMLCC(\''+id+'\').addDateHTML(\''+id+'\');' );
            var opt = document.createElement('option');
            opt.setAttribute('value','');
            opt.innerHTML=anio;
            sel.appendChild(opt);
            for(var i=1991;i > 1929;i--){
                var op = document.createElement('option');
                op.setAttribute('value',i);
                op.innerHTML=i;
                sel.appendChild(op);
            }
        td.appendChild(sel);
    tr.appendChild(td);
    return tr;
}
PaymentBoxCCHTML.prototype.addInteresHTML = function(id,ck,v)
{
    if(document.getElementById('interest_'+id)){
        var interes = document.getElementById('interest_'+id).value;
        if(ck){
            if( interes==''){
                interes = v;
            }else{
                interes += '*'+v;
            }
        }else{
            if( interes!=''){
                interes = interes.replace( '*'+v ,'');
                interes = interes.replace( v+'*' ,'');
                interes = interes.replace( v ,'');
            }
        }
        document.getElementById('interest_'+id).value=interes;
    }
}
PaymentBoxCCHTML.prototype.addDateHTML = function(id)
{
    if(document.getElementById('date_'+id)){
        var dia = document.getElementById('dia_'+id).value;
        var mes = document.getElementById('mes_'+id).value;
        var anio = document.getElementById('anio_'+id).value;
        var date = document.getElementById('date_'+id).value;
        if( dia!='' && mes!='' && anio!='' ){
            date = date.replace( 'd' ,dia);
            date = date.replace( 'm' ,mes);
            date = date.replace( 'a' ,anio);
            document.getElementById('date_'+id).value = date;
        }else{
            document.getElementById('date_'+id).value= 'd*m*a';
        }
    }
}
PaymentBoxCCHTML.prototype.getPassHTML = function(id,t,p)
{
    var n = ( p =='local' || p =='adult')? 'pass' : 'password';
    var tr = document.createElement('tr');
        var td = document.createElement('td');
        td.setAttribute('class', 'spc_first');
            var label = document.createElement('label');
            label.setAttribute('for', n);
            label.innerHTML = t;
        td.appendChild(label);
    tr.appendChild(td);
        var td = document.createElement('td');
            var inp = this.pbh.getInputHTML(n,n,'password','spc_little_textbox',null,null);
            inp.setAttribute('onkeypress', 'this.style.backgroundColor = "#FFFFFF";');
            inp.setAttribute('onblur', 'if(this.value=="" || this.value.length < 5 ){this.style.backgroundColor = "#FF0000";payment.getHTMLCC(\''+id+'\').form_pass=false;}else{ payment.getHTMLCC(\''+id+'\').form_pass=true; }');
        td.appendChild(inp);
    tr.appendChild(td);
    return tr;
}
PaymentBoxCCHTML.prototype.getSubPassHTML = function(t)
{
    var tr = document.createElement('tr');
    tr.appendChild(document.createElement('td'));
        var td = document.createElement('td');
        td.setAttribute('class', 'spc_coments');
        td.innerHTML = t;
    tr.appendChild(td);
    return tr;
}
PaymentBoxCCHTML.prototype.getMailHTML = function(id,m,p)
{
    var n = ( p =='local' || p =='adult')? 'mail' : 'email' ;
    var tr = document.createElement('tr');
        var td = document.createElement('td');
        td.setAttribute('class', 'spc_first');
            var label = document.createElement('label');
            label.setAttribute('for', 'mail');
            label.innerHTML = m;
        td.appendChild(label);
    tr.appendChild(td);
    var td = document.createElement('td');
        var inp = this.pbh.getInputHTML('mail',n,'text','spc_textbox',null,null);
        inp.setAttribute('onkeypress', 'this.style.backgroundColor = "#FFFFFF";');
        inp.setAttribute('onblur', 'if((this.value =="" ) || (this.value.indexOf("@") < 0) || ((this.value.charAt(this.value.length-4) != ".") && (this.value.charAt(this.value.length-3) != "."))){this.style.backgroundColor = "#FF0000";payment.getHTMLCC(\''+id+'\').form_mail=false;}else{ payment.getHTMLCC(\''+id+'\').form_mail=true; }');
    td.appendChild(inp);
    tr.appendChild(td);
    return tr;
}
PaymentBoxCCHTML.prototype.getCheckboxHTML = function(id,n,v,fl)
{
    var tr = document.createElement('tr');
        var td = document.createElement('td');
        td.setAttribute('class', 'spc_first');
    tr.appendChild(td);
        var td = document.createElement('td');
            var label = document.createElement('label');
            label.setAttribute('class', "spc_items");
            if(v){
                if(navigator.appName != 'Microsoft Internet Explorer'){
                    var inp = this.pbh.getInputHTML('opt'+v,'membership','radio','spc_radio',v,null);
                    if(fl) inp.setAttribute('checked','true');
                }else{
                    var check = (fl)? 'checked="checked"' : '';
                    var inp = document.createElement('<input id="opt'+v+'" class="spc_radio" type="radio" '+ check +' value="'+v+'" name="membership"/>');
                }
                td.appendChild(inp);
            }else{
                label.setAttribute('style', "font-weight: bolder;");
            }
            if(v) label.setAttribute('for', 'opt'+v );
            label.innerHTML+=n;
        td.appendChild(label);
    tr.appendChild(td);
    return tr;
}
PaymentBoxCCHTML.prototype.getFormHTML = function(id)
{
    if(!payment.getHTMLCC(id).getBoxCC() || this.pbh.pb.getIsSpa() || navigator.appName == "Microsoft Internet Explorer" ){
        var div_temp = this.pbh.getHeadersHTML();
            var div_global = this.pbh.getGlobalHTML();
            if( this.pbh.pb.getShowLightbox() ){
                var div_cont = this.pbh.getDivHTML(null,'spc_lightbox_content',null);
                div_cont.appendChild(this.pbh.getLightboxClose(id));
            }else{
                var div_cont = div_global;
            }
            if( this.pbh.pb.getPromoContent() != 'adult' && this.pbh.pb.getPromoContent() != 'local' ){
                div_cont.appendChild(this.pbh.getMenuHTML('cc',id));
            }else if( this.pbh.pb.getPromoContent() == 'adult' && this.pbh.pb.getShowTitle() && this.pbh.pb.getShowLightbox()){
                var title_adult = this.pbh.getTitleHTML('Create your account now');
                title_adult.setAttribute('class','spc_am_header main_primary_text');
                if( this.pbh.pb.getBackgroundColor() && this.pbh.pb.getBackgroundColor()!='transparent' ) title_adult.style.color = this.pbh.pb.getBackgroundColor();
                if( this.pbh.pb.getHighlightColor() ) title_adult.style.backgroundColor = this.pbh.pb.getHighlightColor();
                div_cont.appendChild(title_adult);
            }
                var class_main = 'spc_cc_pay';
                if( this.pbh.pb.getPromoContent() == 'adult' ) class_main+=' spc_am_main';
                var div_content = document.createElement('div');
                div_content.setAttribute('class',class_main);
                    if(this.pbh.pb.getShowTitle()){
                        if( this.pbh.pb.getPromoContent() == 'adult' && !this.pbh.pb.getShowLightbox() || this.pbh.pb.getPromoContent() != 'adult'){
                            div_content.appendChild(this.pbh.getTitleHTML('Create your account now'));
                        }
                    }
                // -- SubTitle
                    if(this.pbh.pb.getShowTitle() && this.pbh.pb.getPromoContent() != 'adult') div_content.appendChild(this.pbh.getSubTitleHTML('Access ' ,'9,166  videos' ,' DVD quality' ));
                // -- Form
                    var form = this.pbh.getTagFormHTML('spc_cc_form_'+id,'post','https://secure.spanetworks.com');
                    form.setAttribute('name', 'secForm');
                    var table = this.pbh.getTableHTML();
//                    table.style.color = '#000000';

                    if( this.pbh.pb.getPromoContent() == 'adult' || this.pbh.pb.getPromoContent() == 'local'){
                    // -- Soy
                        table.appendChild(this.getSoyUserHTML(id,'',this.pbh.pb.getPromoContent()));
                        if(this.pbh.pb.getPromoContent() =='adult'){
                            // -- Interesa
                            table.appendChild(this.getInteresHTML(id,'',this.pbh.pb.getPromoContent()));
                            form.appendChild(this.pbh.getHiddenHTML('interest_'+id,'interest','f'));
                        }else{
                            table.appendChild(this.getDateHTML(id,'','','',''));
                            form.appendChild(this.pbh.getHiddenHTML('date_'+id,'date','d*m*a'));
                        }
                    }
                    if( this.pbh.pb.getPromoContent() == 'adult' ||  this.pbh.pb.getPromoContent() == 'local'){
                        // -- E-mail
                            table.appendChild(this.getMailHTML(id,'Email',this.pbh.pb.getPromoContent()));
                        // -- User
                            table.appendChild(this.getUserHTML(id,'Choose a nickname',this.pbh.pb.getPromoContent()));
                        // -- Pass
                            table.appendChild(this.getPassHTML(id,'Password',this.pbh.pb.getPromoContent()));
                            table.appendChild(this.getSubPassHTML('It must be at least 5 characters long'));
                    }else{
                         // -- User
                        table.appendChild(this.getUserHTML(id,'Choose a nickname',this.pbh.pb.getPromoContent()));
                        // -- Pass
                            table.appendChild(this.getPassHTML(id,'Password',this.pbh.pb.getPromoContent()));
                            table.appendChild(this.getSubPassHTML('It must be at least 5 characters long'));
                        // -- E-mail
                            table.appendChild(this.getMailHTML(id,'Email',this.pbh.pb.getPromoContent()));
                    }
                    if( this.pbh.pb.getPromoContent() !='trans' ){
                    // -- Options
                        this.pbh.pb.setPaymentOptions(new Array(new Array('OFFER! 1-Day Trial Membership - $1.00',250,false),new Array('1-Month Membership - $24.95',238,true),new Array('Best Deal - $7.95 a Month ($95.40 billed yearly)',104,false)));
                        if( this.pbh.pb.getPaymentOptions()){
                            var options = this.pbh.pb.getPaymentOptions();
                            var flag = false;
                            for (var i=0; i< options.length; i++){
                                if(options[i][1]){
                                    table.appendChild(this.getCheckboxHTML(id,options[i][0],options[i][1],options[i][2]));
                                }else{
                                    table.appendChild(this.getCheckboxHTML(id,options[i][0]));
                                }

                            }
                        }
                    }
                    // -- Button
                        var control = 'if(payment.getHTMLCC(\''+id+'\').form_user && payment.getHTMLCC(\''+id+'\').form_pass && payment.getHTMLCC(\''+id+'\').form_mail )';
                        table.appendChild(this.pbh.getButtonHTML('Next step', control +' document.getElementById(\'spc_cc_form_'+id+'\').submit()'));
                    // -- Footer
                        var tr = document.createElement('tr');
                            var td = document.createElement('td');
                            td.setAttribute('class', 'spc_first');
                        tr.appendChild(td);
                            var td = document.createElement('td');
                            td.innerHTML = this.pbh.getFooterHTML('Already have an account? ','javascript:payment.getHTMLLOG(\''+id+'\').drawBox(document.getElementById(\'box_'+id+'\'),\''+id+'\');','Sign in','log');
                        tr.appendChild(td);
                        table.appendChild(tr);
                    form.appendChild(table);
                    if( this.pbh.pb.getPromoContent() == 'video' || this.pbh.pb.getPromoContent() == 'webcam'  || this.pbh.pb.getPromoContent() == 'trans'){
                        form.appendChild(this.pbh.getHiddenHTML(null,'country','us'));
                        form.appendChild(this.pbh.getHiddenHTML(null,'tour','20'));
                        form.appendChild(this.pbh.getHiddenHTML(null,'optr','1'));
                        form.appendChild(this.pbh.getHiddenHTML(null,'trial','1'));
                        form.appendChild(this.pbh.getHiddenHTML(null,'track','sexohentai'));
                        form.appendChild(this.pbh.getHiddenHTML(null,'account','adrian'));
                        form.appendChild(this.pbh.getHiddenHTML(null,'c','1'));
                        form.appendChild(this.pbh.getHiddenHTML(null,'d','1'));
                        form.appendChild(this.pbh.getHiddenHTML(null,'join','0'));
                        form.appendChild(this.pbh.getHiddenHTML(null,'def',''));
                        form.appendChild(this.pbh.getHiddenHTML(null,'beta','1'));
                        form.appendChild(this.pbh.getHiddenHTML(null,'idprice',''));
                        form.appendChild(this.pbh.getHiddenHTML(null,'chk_p',''));
                        form.appendChild(this.pbh.getHiddenHTML(null,'counter','pbox_0'));
                        form.appendChild(this.pbh.getHiddenHTML(null,'idreferer','121568'));
                        form.appendChild(this.pbh.getHiddenHTML(null,'fname',''));
                        form.appendChild(this.pbh.getHiddenHTML(null,'lname',''));
                        form.appendChild(this.pbh.getHiddenHTML(null,'cccountry','us'));
                        form.appendChild(this.pbh.getHiddenHTML(null,'zipcode',''));
                        form.appendChild(this.pbh.getHiddenHTML(null,'lang','us'));
                        form.appendChild(this.pbh.getHiddenHTML(null,'idwd','10055'));
                        form.appendChild(this.pbh.getHiddenHTML(null,'idc','2916'));
                        form.appendChild(this.pbh.getHiddenHTML(null,'type','2912'));
                        form.appendChild(this.pbh.getHiddenHTML(null,'id_track','1465451'));
                        form.appendChild(this.pbh.getHiddenHTML(null,'paytype','rev'));
                        form.appendChild(this.pbh.getHiddenHTML(null,'offer','1'));
                        form.appendChild(this.pbh.getHiddenHTML(null,'securelogo','1'));
                        form.appendChild(this.pbh.getHiddenHTML(null,'rnd','0'));
                    }else{
                        form.appendChild(this.pbh.getHiddenHTML(null,'signup','complete'));
                        var append = '';
                        var temp = append.split('&');
                        for (var i=0; i< temp.length; i++){
                               var temp2 = temp[i].split('=');
                               form.appendChild(this.pbh.getHiddenHTML(null,temp2[0],temp2[1]));
                        }
                    }
                div_content.appendChild(form);
            div_cont.appendChild(div_content);
            if( this.pbh.pb.getShowLightbox() ){
                div_global.appendChild(div_cont);
                div_cont = div_global;
            }
        div_temp.appendChild(div_cont);
        payment.getHTMLCC(id).setBoxCC(div_temp.innerHTML);
    }
    return payment.getHTMLCC(id).getBoxCC();
}
PaymentBoxCCHTML.prototype.drawBox = function(htmlobject,id)
{
    if ( typeof(htmlobject) == 'undefined' || !htmlobject ) var htmlobject = document.createElement('div');
    htmlobject.innerHTML = this.getFormHTML(id);
}
//Se setea un nuevo boxhtmlcc cada vez que se incluye esta clase
payment.setHTMLCC(new PaymentBoxCCHTML(payment.getHTML(payment.getKey())));








var PaymentBoxLOGHTML = function(pbh)
{
	this.pbh = pbh;
	this.form_user = false;
	this.form_pass = false;
}
PaymentBoxLOGHTML.prototype.setBoxLOG = function(objec)
{
	this.boxLOG=objec;
}
PaymentBoxLOGHTML.prototype.getBoxLOG = function()
{
	return this.boxLOG;
}
PaymentBoxLOGHTML.prototype.getUserHTML = function(id,t,p)
{
	var n = ( p =='local' || p =='adult')? 'login' : 'usrsc';
	var tr = document.createElement('tr');
		var td = document.createElement('td');
			var div_user = this.pbh.getDivHTML(null,'input_title',null,"display: block");
			div_user.innerHTML = t;
		td.appendChild(div_user);
			var inp = this.pbh.getInputHTML('user',n,'text','spc_textbox',null,null);
			inp.setAttribute('onkeypress', 'this.style.backgroundColor = "#FFFFFF";');
			inp.setAttribute('onblur', 'if(this.value==""){this.style.backgroundColor = "#FF0000";payment.getHTMLLOG(\''+id+'\').form_user=false;}else{ payment.getHTMLLOG(\''+id+'\').form_user=true;}');
		td.appendChild(inp);
	tr.appendChild(td);
	return tr;
}
PaymentBoxLOGHTML.prototype.getPassHTML = function(id,t,p)
{
	var n = ( p =='local' || p =='adult')? 'password_login' : 'password';
	var tr = document.createElement('tr');
		var td = document.createElement('td');
			var div_user = this.pbh.getDivHTML(null,'input_title',null,"display: block");
			div_user.innerHTML = t;
		td.appendChild(div_user);
			var inp = this.pbh.getInputHTML(n,n,'password','spc_textbox',null,null);
			inp.setAttribute('onkeypress', 'this.style.backgroundColor = "#FFFFFF";');
			inp.setAttribute('onblur', 'if(this.value=="" || this.value.length < 5 ){this.style.backgroundColor = "#FF0000";payment.getHTMLLOG(\''+id+'\').form_pass=false;}else{ payment.getHTMLLOG(\''+id+'\').form_pass=true; }');
		td.appendChild(inp);
	tr.appendChild(td);
	return tr;
}
PaymentBoxLOGHTML.prototype.getCookieHTML = function(id,t)
{
	var tr = document.createElement('tr');
		var td = document.createElement('td');
			var label = document.createElement('label');
			label.setAttribute( 'for', 'cookie_want_set_'+id );
				var inp = this.pbh.getInputHTML('cookie_want_set_'+id,'cookie_want_set','checkbox',null,null,null);
			label.appendChild(inp);
			label.innerHTML += t;
		td.appendChild(label);
	tr.appendChild(td);
	return tr;
}
PaymentBoxLOGHTML.prototype.getLightboxClose = function( id )
{
	var div = this.pbh.getDivHTML(null,'spc_close spc_opacity','x',null);
	div.setAttribute('onclick','javascript:payment.getHTMLCC(\''+id+'\').drawBox(document.getElementById(\'box_'+id+'\'),\''+id+'\');');
	if( this.pbh.pb.getTextColor() ) div.style.borderColor = this.pbh.pb.getTextColor();
	return div;
}
PaymentBoxLOGHTML.prototype.getRightBox = function( id )
{
	var div = this.pbh.getDivHTML(null,'spc_fright',null,null);
		div.appendChild(this.pbh.getTitleHTML('Sign up now!'));
		var p_text = 'Unlimited download access';
		if( p_text !=''){
			var p = document.createElement('p');
			p.innerHTML=p_text;
			div.appendChild(p);
		}
		var ul = document.createElement('ul');
			var li = document.createElement('li');
			li.innerHTML='Takes less than a minute!';
			ul.appendChild(li);
			var li = document.createElement('li');
			li.innerHTML='Unlimited access';
			ul.appendChild(li);
			var li = document.createElement('li');
			li.innerHTML='More than 3200 DVDs';
			ul.appendChild(li);
			var li = document.createElement('li');
			li.innerHTML='5 new videos every day';
			ul.appendChild(li);
		div.appendChild(ul);
		var a = document.createElement('a');
		a.setAttribute('onclick','javascript:payment.getHTMLCC(\''+id+'\').drawBox(document.getElementById(\'box_'+id+'\'),\''+id+'\'); return false;');
		a.setAttribute('href','#');
		a.setAttribute('class','spc_big_link');
		a.innerHTML='Register Now';
		div.appendChild(a);
	return div;
}
PaymentBoxLOGHTML.prototype.getFormHTML = function(id)
{
	var div_temp = this.pbh.getHeadersHTML();
		var div_global = this.pbh.getGlobalHTML('log');
			if( this.pbh.pb.getShowLightbox() ){
				var div_cont = this.pbh.getDivHTML(null,'spc_lightbox_content',null);
				div_cont.appendChild(this.pbh.getLightboxClose(id));
			}else{
				var div_cont = div_global;
			}
			var div_content = this.pbh.getDivHTML(null,'spc_login',null,null);
				//Left
				var div_left = this.pbh.getDivHTML(null,'spc_fleft',null,null);
				// -- Title
					if(this.pbh.pb.getShowTitle()) div_left.appendChild(this.pbh.getTitleHTML('Sign in'));
				// -- Form
					var div_form = this.pbh.getDivHTML(null,'form',null,null);
						var form = this.pbh.getTagFormHTML('login_form_'+id,'post','http://www.allanimemovies.com/?account=adrian&track=sexohentai&alias=xd&rev=yes');
						var table = this.pbh.getTableHTML('','');
						table.setAttribute('cellpadding','0');
						table.setAttribute('width','100%');
						// -- User
							table.appendChild(this.getUserHTML(id,'User',this.pbh.pb.getPromoContent()));
						// -- Pass
							table.appendChild(this.getPassHTML(id,'Password',this.pbh.pb.getPromoContent()));
						// -- Cookie
							table.appendChild(this.getCookieHTML(id,' Remember me on this computer'));
						// -- Button
							var tr = document.createElement('tr');
								var td = document.createElement('td');
									var control = 'if(payment.getHTMLLOG(\''+id+'\').form_user && payment.getHTMLLOG(\''+id+'\').form_pass )';
									td.appendChild(this.pbh.getButtonHTML('Sign in', control +' document.getElementById(\'login_form_'+id+'\').submit()',true));
								tr.appendChild(td);
							table.appendChild(tr);
						// -- Footer
							var tr = document.createElement('tr');
								var td = document.createElement('td');
								td.innerHTML = this.pbh.getFooterHTML('','http://support.allanimemovies.com/forgotpass.php?lang=us','Have you forgotten your password?');
							tr.appendChild(td);
							table.appendChild(tr);
						form.appendChild(table);
					div_form.appendChild(form);
				div_left.appendChild(div_form);
			div_content.appendChild(div_left);
			//Right
			div_content.appendChild(this.getRightBox(id));
			div_content.appendChild(this.pbh.getDivHTML(null,'spc_clear',null,null));
		div_cont.appendChild(div_content);
		if( this.pbh.pb.getShowLightbox() ){
			div_global.appendChild(div_cont);
			div_cont=div_global;
		}
	div_temp.appendChild(div_cont);
	payment.getHTMLLOG(id).setBoxLOG(div_temp.innerHTML);
	return payment.getHTMLLOG(id).getBoxLOG();
}
PaymentBoxLOGHTML.prototype.drawBox = function(htmlobject,id)
{
	if ( typeof(htmlobject) == 'undefined' || !htmlobject ) var htmlobject = document.createElement('div');
	htmlobject.innerHTML = this.getFormHTML(id);
}

payment.setHTMLLOG(new PaymentBoxLOGHTML(payment.getHTML(payment.getKey())));

payment.getBox('a266a66212ee723b81485f577dac311d').setIdContainer('a266a66212ee723b81485f577dac311d');
payment.getBox('a266a66212ee723b81485f577dac311d').setPromoContent('video');
payment.getBox('a266a66212ee723b81485f577dac311d').setQueryString('account=adrian&track=sexohentai&alias=xd&rev=yes');
payment.getBox('a266a66212ee723b81485f577dac311d').setStyleSite('http://assets.sites.spacash.com/sites/allanimemovies.com/css/paybox_tool_color.css');
payment.getBox('a266a66212ee723b81485f577dac311d').setShowLightbox();

payment.getBox('a266a66212ee723b81485f577dac311d').setSmsAccess('espia');
payment.getBox('a266a66212ee723b81485f577dac311d').setWidthBox(533);





payment.getBox('a266a66212ee723b81485f577dac311d').setTextColor('#75264E')


payment.getBox('a266a66212ee723b81485f577dac311d').setButtonColor('#CC00FF')


document.write(payment.getHTML('a266a66212ee723b81485f577dac311d').drawBox());
if( typeof(SPC_PaymentBox_Completed) != 'undefinded' && typeof(SPC_PaymentBox_Completed) == 'function' ){
	SPC_PaymentBox_Completed(payment);
}