function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}
function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1; 
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return "";
}

function showLogo(logo) {
	document.getElementById('logo_layer_img').src='./media/templatedata/'+logo+'.gif';
	document.getElementById('logo_layer').style.display='block';
}
function closeLayer() {
	document.getElementById('logo_layer').style.display='none';
}

Browser = {
   IE:    !!(window.attachEvent && !window.opera),
   Opera:    !!window.opera,
   WebKit:    navigator.userAgent.indexOf('AppleWebKit/') > -1,
   Gecko:    navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1,
   MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/),
   Safari: (navigator.userAgent.indexOf('Gecko') > -1 && /Safari/.test(navigator.userAgent) && /KHTML/.test(navigator.userAgent)),
   Chrome: (navigator.userAgent.indexOf('Gecko') > -1 && /Chrome/.test(navigator.userAgent) && /KHTML/.test(navigator.userAgent))
}
   ChatInvitationSound = {
   _enabled: true,
   enable: function(){
       ChatInvitationSound._enabled = true;
     },
   disable: function(){
         ChatInvitationSound._enabled = false;
   },
   _container: 'embed',
   play: function(url){
       if(!ChatInvitationSound._enabled) return;
             if(Browser.IE)
       {
           oBgsound = document.createElement('BGSOUND');
           oBgsound.id = 'sound';
           oBgsound.src = url;
           oBgsound.loop = 0;
           oBgsound.autostart = true;
           document.body.appendChild(oBgsound);
       }
       else
       {
           switch(ChatInvitationSound._container)
           {
               case 'embed':
                   oBgsound = document.createElement('EMBED');
                   oBgsound.id = 'sound';
                   oBgsound.src = url;
                   oBgsound.loop = false;
                   oBgsound.autostart = true;
                   oBgsound.hidden = true;
                   oBgsound.width = '0';
                   oBgsound.height = '0'
                   document.body.appendChild(oBgsound);
                   break;
               case 'object':
                   oBgsound = document.createElement('OBJECT');
                   oBgsound.id = 'sound';
                   oBgsound.data = url;
                   oBgsound.type = 'audio/mpeg';
                   oBgsound.width = '0';
                   oBgsound.height = '0'
                   document.body.appendChild(oBgsound);
                   break;               }
       }
     }
}

if((Browser.Gecko && navigator.userAgent.indexOf('Win') > 0) ||
   Browser.Safari ||
   Browser.Chrome) {
   if(navigator.plugins)
   {
       qt_found = false;
       for(var i = 0; i < navigator.plugins.length; i++)
       {
           if(navigator.plugins[i].name.indexOf('QuickTime') != -1)
           {
               qt_found = true;                           }
                      if(qt_found == true) break;
       }
       if(qt_found == true)
       {
           ChatInvitationSound._container = 'object';
       }
   }
   else
   {
       ChatInvitationSound.play = function(){}
   }
}