
//    nm for SummerWeb - Ruckus Entertainment 03/10/06
//    javascript - client-side functionality


   var timer1;
   var tmrSmrKik=0;

 
/* here is a sad solution from quirksmode.com
   for inner divs that use the illegal height=100%
   in a container where height=auto  ---------- */ 

   function iniStretchDiv() {
       stretchDiv('vc_ctr_left'); 
       //stretchDiv('ctr_left'); 
       }


     function stretchDiv(eid) {
        //alert('stretching ' + eid);
        //alert(eid + ':' + document.getElementById(eid));
        if (document.getElementById(eid)){
           var elm = document.getElementById(eid);
           var p = elm.parentNode;
           //var po = elm.offsetParent;
           //alert(eid + ':' + elm.id + ', ' + elm.nodeName + ', ' + elm.clientHeight + ', ' + elm.offsetParent.id +', ' + po.clientHeight + '\npar:' +p.id + ', ' + p.nodeName + ', ' + p.clientHeight);
           elm.style.height = 'auto';
           var x = p.clientHeight;
           //alert('height:' + x); 
           elm.style.height = x + "px";
          }
      }



   function toggle_SmrPx1(){
        // summerweb: homepage: content: rightside image swap
         var imga = document.getElementById('smrpx1a');
         var imgb = document.getElementById('smrpx1b');
         self.clearTimeout(timer1);
         //alert('diplay=a' + imga.style.display + '  b=' + imgb.style.display )
         if (imgb.style.display == 'none') {
               imgb.style.display = 'block';
               imga.style.display = 'none';
              }
         else{imgb.style.display = 'none'
               imga.style.display = 'block';
              } 
         var is_kick = imgb.style.display;
         if (is_kick == 'block'){set_SmrPx1(5000);}          
        }


    function set_SmrPx1(s){
          timer1 = self.setTimeout("var imga = document.getElementById('smrpx1a'); var imgb = document.getElementById('smrpx1b'); imgb.style.display = 'none'; imga.style.display = 'block';" , s); 
             } 




   function toggle_video(){
        // summerweb: homepage: content: videoplayer
        //   toggels an img of a video player with a still on the screen and the actual videoplayer

        // alert('toggle_video' ) // display) =' + sdiv.style.display);

         var vid_still = document.getElementById('video_still');
         var vid_play = document.getElementById('video_play');
         if (vid_play.style.display == 'none') {
               vid_play.style.display = 'block';
               vid_still.style.display = 'none';
              }
        }



   function playvid(swf, h, w){

      var agt = navigator.userAgent.toLowerCase();
      var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
      
      var vname = swf.substring(0, swf.indexOf('.'))


      if (document.getElementsByName){
         cn = document.getElementById('divsrvplayer');
         // remove all children from element
         while (cn.firstChild) {
            cn.removeChild(cn.firstChild);
            }

         if (is_ie){
            em  = document.createElement('embed');
            em.setAttribute("src", swf);         
            em.setAttribute("menu", "false");         
            em.setAttribute("quality", "high");         
            em.setAttribute("wmode", "transparent");         
            em.setAttribute("name", vname);
            em.setAttribute("id", "vname");
            em.setAttribute("allowScriptAccess", "sameDomain");
            em.setAttribute("type", "application/x-shockwave-flash");
            em.setAttribute("pluginspage", "srvideo");
            em.setAttribute("allowScriptAccess", "http://www.macromedia.com/go/getflashplayer");
            em.setAttribute("width", w);         
            em.setAttribute("height", h);

            fl = cn.appendChild(em);
             } //if is_ie
         else { 
            ob = document.createElement("OBJECT");
            ob.setAttribute("classid", "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000");         
            ob.setAttribute("codebase", "http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0");         
            ob.setAttribute("id", vname);  
            ob.setAttribute("width", w);         
            ob.setAttribute("height", h);                
            p1 = ob.appendChild(document.createElement('param'));
            p1.setAttribute("name", "allowScriptAccess");         
            p1.setAttribute("value", "sameDomain");         
            p2 = ob.appendChild(document.createElement('param'));
            p2.setAttribute("name", "movie");         
            p2.setAttribute("value", swf);         
            p3 = ob.appendChild(document.createElement('param'));
            p3.setAttribute("name", "menu");         
            p3.setAttribute("value", "false");         
            p4 = ob.appendChild(document.createElement('param'));
            p4.setAttribute("name", "quality");         
            p4.setAttribute("value", "high");         
            p5 = ob.appendChild(document.createElement('param'));
            p5.setAttribute("name", "wmode");         
            p5.setAttribute("value", "transparent");         
            em = ob.appendChild(document.createElement('embed'));
            em.setAttribute("src", swf);         
            em.setAttribute("menu", "false");         
            em.setAttribute("quality", "high");         
            em.setAttribute("wmode", "transparent");         
            em.setAttribute("name", vname);
            em.setAttribute("allowScriptAccess", "sameDomain");
            em.setAttribute("type", "application/x-shockwave-flash");
            em.setAttribute("pluginspage", vname);
            em.setAttribute("allowScriptAccess", "http://www.macromedia.com/go/getflashplayer");
            em.setAttribute("width", w);         
            em.setAttribute("height", h);

           fl = cn.appendChild(ob);

         } //else is_ie         
    /*
         hdr = document.getElementById('header');
         if (hdr.hasChildNodes()){
            nl = hdr.childNodes;
            //alert('hdr_child nl len=' + nl.length + '\n');
            msg = '';
            for (var i = 0; i < nl.length; i++){
               msg = msg + i + ' name:' + nl[i].nodeName + '  value:' + nl[i].nodeValue + '\n';
               }
            alert(msg);
           }
         else {
            alert('hdr has NO childnodes');
              }
    */

        } //if getElbyID
      } //function end



   function playmp3(mp3name ){
      //alert('playmp3(' + mp3name + ')'); 

      //window.location.reload( false );

      var agt = navigator.userAgent.toLowerCase();
      var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
      var is_sf = (agt.indexOf("safari") != -1) ;
      var str='';
      if (document.getElementsByName){
         cn = document.getElementById('mp3div');
         // remove all children from element
         while (cn.firstChild) {
            cn.removeChild(cn.firstChild);
            }

         if (is_ie || is_sf){
            frm = document.createElement('form');
            frm.setAttribute('name', 'mp3frm');
            frm.setAttribute('id', 'mp3frm');
            frm.setAttribute('action', 'index.asp?page_event=music&args=' + mp3name);
            frm.setAttribute('method', 'post');
            cn.appendChild(frm);
          //  document.getElementById('mp3frm').submit();
            document.forms('mp3frm').submit();
            return true;

           /*
            em  = document.createElement('embed');
            em.setAttribute("src", mp3name);         
            em.setAttribute("autostart", "true");         
            em.setAttribute("name", "mp3player");
            em.setAttribute("id", "mp3player");
            em.setAttribute("wmode", "transparent");         
            em.setAttribute("loop", "false");         
            em.setAttribute("disabled", "true");         
            em.setAttribute("hidden", "false");
            em.setAttribute("controller", "true");         
            em.setAttribute("controls", "true");         
            fl = cn.appendChild(em);
            */
             } //if is_ie
         else { 
            ob = document.createElement("OBJECT");
            ob.setAttribute("name", "mp3player");         
            ob.setAttribute("id", "mp3player");         
            p1 = ob.appendChild(document.createElement('param'));
            p1.setAttribute("name", "src");         
            p1.setAttribute("value", mp3name);         
            p2 = ob.appendChild(document.createElement('param'));
            p2.setAttribute("name", "controller");         
            p2.setAttribute("value", "false");         
            p3 = ob.appendChild(document.createElement('param'));
            p3.setAttribute("name", "autostart");         
            p3.setAttribute("value", "true");         
            p4 = ob.appendChild(document.createElement('param'));
            p4.setAttribute("name", "autoplay");         
            p4.setAttribute("value", "true");         
            p5 = ob.appendChild(document.createElement('param'));
            p5.setAttribute("name", "wmode");         
            p5.setAttribute("value", "transparent");         
            p6 = ob.appendChild(document.createElement('param'));
            p6.setAttribute("name", "hidden");         
            p6.setAttribute("value", "true");         
            p7 = ob.appendChild(document.createElement('param'));
            p7.setAttribute("name", "controls");         
            p7.setAttribute("value", "false");         
            em = ob.appendChild(document.createElement('embed'));
            em.setAttribute("src", mp3name);         
            em.setAttribute("autostart", "true");         
            em.setAttribute("name", "mp3player");
            em.setAttribute("id", "mp3player");
            em.setAttribute("wmode", "transparent");         
            em.setAttribute("loop", "false");         
            em.setAttribute("hidden", "true");
            em.setAttribute("controller", "false");         
            em.setAttribute("controls", "false");         
            fl = cn.appendChild(ob);
         } //else is_ie         
       } //if getElbyID
    } //function end





  function toggleshipping(){
         var sdiv = document.getElementById('add_ship');
         var bdiv = document.getElementById('add_bill');
         var ckbx = document.getElementById('checkship');
         var dvsb = document.getElementById('div_ship_bill');
         //nl = dvsb.childNodes; for (i=0; i< nl.length; i++){alert(i + ':' + nl[i].nodeName + ' - ' + nl[i].nodeValue );}
         //alert('toggleshipping display=' + sdiv.style.display);
         if (sdiv.style.display == 'none') {
               sdiv.style.display = 'block';
               bdiv.style.display = 'none';
               dvsb.childNodes[1].nodeValue = 'Display my Billing information.';
               ckbx.checked = 0; 
                }
         else {
                sdiv.style.display = 'none';
                bdiv.style.display = 'block';
                dvsb.childNodes[1].nodeValue = ' My shipping information is different from my billing information.';
                ckbx.checked = 0; 
                // var cbx = document.getElementById('checkship');
                ckbx.checked = 0; 
              };
         //stretchDiv('vc_ctr_left'); 
         }




   function imgwin(fn, fh, fw){
    // alert('imgwin(' + fn + ', ' + fh + ', ' + fw + ')');
     fn = '../images/gallery/' + fn  ;
     fw = 'width=' + fw * 1.05 ;
     fh = 'height=' + fh * 1.05;
     args = fh + ',' + fw ;
      winimg = window.open(fn , 'SummerRose', args);
     } 
