var donotcheck;
var donotchecktop;
var sURL = unescape(window.location.pathname);
function rollOver(idName){
	
	var dd = idName.src.split(".gif");
	idName.src=dd[0]+"y.gif";
}
function rollOut(idName){
	
	var dd = idName.src.split("y.gif");
	idName.src=dd[0]+".gif";
}

	
function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


       
            function clearText() {
				
				
                 this.form1.searchBox.value = ""
            }
           
            function resetText() {
                if(document.form1.searchBox.value == "")
                    document.form1.searchBox.value = "(enter something here)"
            }    
            
            function letgo(){
            
           
				if(document.form1.searchBox.value == ""){
                    alert("Please enter a event or venue!");
				}else{
					window.location.replace("events.aspx?slink=1&z=" + document.form1.defaultzone.value  + "&p=1&st=" + document.form1.searchBox.value);
				}
            
            }
            
            function entsub(event,ourform) {
				if (event && event.which == 13){
					alert("Quick search is activated by clicking on the search button");
					ourform.submit();
				}else
			return true;}
			

   var http_request = false;
   function makeRequest(url, parameters) {
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
            http_request.overrideMimeType('text/xml');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      http_request.onreadystatechange = alertContents;
      http_request.open('GET', url + parameters, true);
      http_request.send(null);
   }

   function alertContents() {
      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
            //alert(http_request.responseText);
            result = http_request.responseText;
            if(result == "doRefresh"){
				//window.open("dorefresh.aspx","popup","width=500,height=200,scrollbars,resizable");
				//document.updatealert.display.value = "The data is updated.";
				//document.updatealert.display.visibility="show"
				//alert("doit");
				//var oDiv = document.getElementById("set_1");
				//with(oDiv) {
				//	style.visibility = 'hidden';

				//	style.display = 'none';
				//}
				//donotcheck = 'yes';
				window.location.href = sURL;
   
				
            }
           // result = http_request.responseText;
            //document.getElementById('myspan').innerHTML = result;   
            
            
           
	
	         
         } else {
           // alert('There was a problem with the request. (main)');
         }
      }
   }
   
   
   function makeRequest_test(url, parameters) {
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
            http_request.overrideMimeType('text/xml');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      http_request.onreadystatechange = alertContents_test;
      http_request.open('GET', url + parameters, true);
      http_request.send(null);
   }

   function alertContents_test() {
   
	
      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
            //alert(http_request.responseText);
            result = http_request.responseText;
            if(result == "doRefresh"){
				
				window.location.href = sURL;
   
				
            }
              
            
           
	
	         
         } else {
           
         }
      }
   }
   
   
   
    function makeRequest_new(url, parameters) {
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
            http_request.overrideMimeType('text/xml');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      http_request.onreadystatechange = alertContents_new;
      http_request.open('GET', url + parameters, true);
      http_request.send(null);
   }

   function alertContents_new() {
      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
            //alert(http_request.responseText);
            result = http_request.responseText;
            if(result == "doRefresh"){
				//alert("startrefresh");
				//window.open("dorefresh.aspx","popup","width=500,height=200,scrollbars,resizable");
				//document.updatealert.display.value = "The data is updated.";
				//document.updatealert.display.visibility="show"
				//alert("doit");
				//var oDiv = document.getElementById("set_1");
				//with(oDiv) {
				//	style.visibility = 'hidden';

				//	style.display = 'none';
				//}
				//donotcheck = 'yes';
				window.location.href = sURL;
   
				
            }
           // result = http_request.responseText;
            //document.getElementById('myspan').innerHTML = result;   
            
            
           
	
	         
         } else {
           // alert('There was a problem with the request. (main)');
         }
      }
   }
   
   
   function get(obj) {
      var getstr = "?";
      for (i=0; i<obj.childNodes.length; i++) {
         if (obj.childNodes[i].tagName == "INPUT") {
            if (obj.childNodes[i].type == "text") {
               getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";
            }
            if (obj.childNodes[i].type == "checkbox") {
               if (obj.childNodes[i].checked) {
                  getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";
               } else {
                  getstr += obj.childNodes[i].name + "=&";
               }
            }
            if (obj.childNodes[i].type == "radio") {
               if (obj.childNodes[i].checked) {
                  getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";
               }
            }
         }   
         if (obj.childNodes[i].tagName == "SELECT") {
            var sel = obj.childNodes[i];
            getstr += sel.name + "=" + sel.options[sel.selectedIndex].value + "&";
         }
         
      }
      makeRequest('get.php', getstr);
   }

	
	
	
     var x = 10;
     var y = 1;
     var oldtime;
     
 function setTime(tmptime){
 
	oldtime = tmptime;
 }
     
       function startClock(){
        x = x-y
        //document.frm.clock.value = x
       
        setTimeout("startClock()", 8000)
        if(x==0){
			
			if( donotcheck != "yes"){
				//alert(oldtime);
				makeRequest('checktime.aspx', '?oldtime=' + oldtime);
				x=10;
			}
           }
       }
       
       
        function startClock_test(){
        
			//alert("hello");
			
			setTimeout("startClock_test()", 8000);
			
      		makeRequest_test('checktime_a.aspx', '?oldtime=' + oldtime);
			
       }
       
        function startClock_new(){
        x = x-y
        //document.frm.clock.value = x
       //alert("startclock_new");
		var browserName = whichBrs();
          
       
    
        setTimeout("startClock_new()", 28000)
        
      
       
		//alert(browserName);
		
		makeRequest_new('checktime_t.aspx', '?oldtime=' + oldtime);

       }
       
     var a = 10;
     var b = 1;
     
       
       
     function startClockForTop(){
        a = a-b
        //document.frm.clock.value = x
       
        setTimeout("startClockForTop()", 30000)
        if(a==0){
			if( donotchecktop != "yes"){
				//alert(oldtime);
				makeRequestTop('updatecheck1.aspx', '');
				a=10;
			}
			
           }
       }    
       
       
       
       
       
       
     function makeRequestTop(url, parameters) {
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
            http_request.overrideMimeType('text/xml');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      http_request.onreadystatechange = alertContentsTop;
      http_request.open('GET', url + parameters, true);
      http_request.send(null);
   }

   function alertContentsTop() {
      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
            //alert(http_request.responseText);
            result = http_request.responseText;
            if(result == "dopma"){
				//window.open("dorefresh.aspx","popup","width=500,height=200,scrollbars,resizable");
				//document.updatealert.display.value = "The data is updated.";
				//document.updatealert.display.visibility="show"
			
				var oDiv = document.getElementById("set_3");
				with(oDiv) {
					style.visibility = 'visible';

					style.display = 'block';
				}
					
            }else{
            
				var oDiv = document.getElementById("set_3");
				
				if(oDiv != null){
					with(oDiv) {
						style.visibility = 'hidden';

						style.display = 'none';
					}
				}
            
            
            }
            
             if(result == "dopromoa"){
				//window.open("dorefresh.aspx","popup","width=500,height=200,scrollbars,resizable");
				//document.updatealert.display.value = "The data is updated.";
				//document.updatealert.display.visibility="show"
				
				var oDiv = document.getElementById("set_2");
				with(oDiv) {
					style.visibility = 'visible';

					style.display = 'block';
				}
				
            }else{
            
            
				var oDiv = document.getElementById("set_2");
				
				if(oDiv != null){
				with(oDiv) {
					style.visibility = 'hidden';

					style.display = 'none';
				}
				}
            
            
            }
            
            
             if(result == "dopromodopma"){
				//window.open("dorefresh.aspx","popup","width=500,height=200,scrollbars,resizable");
				//document.updatealert.display.value = "The data is updated.";
				//document.updatealert.display.visibility="show"
				
				var oDiv = document.getElementById("set_2");
				with(oDiv) {
					style.visibility = 'visible';

					style.display = 'block';
				}
				
				
				var oDiv1 = document.getElementById("set_3");
				with(oDiv1) {
					style.visibility = 'visible';

					style.display = 'block';
				}
				
				
            }
            
            
            
            
            
            
            
           // result = http_request.responseText;
            //document.getElementById('myspan').innerHTML = result;   
            
            
           
	
	         
         } else {
            //alert('There was a problem with the request. (top)'+http_request.status);
         }
      }
   }
       
       
       
       
       
   

function refresh()
{
  
    window.location.href = sURL;
    
    
    
}

function stoprefreshpage()
{
  
    donotcheck = 'yes';
    var oDiv = document.getElementById("set_1");
		with(oDiv) {
			style.visibility = 'hidden';
			style.display = 'none';
		
	}
}



		

var flashlinks=new Array()

function changelinkcolor(){
for (i=0; i< flashlinks.length; i++){
var flashtype=document.getElementById? flashlinks[i].getAttribute("flashtype")*1 : flashlinks[i].flashtype*1
var flashcolor=document.getElementById? flashlinks[i].getAttribute("flashcolor") : flashlinks[i].flashcolor
if (flashtype==0){
if (flashlinks[i].style.color!=flashcolor)
flashlinks[i].style.color=flashcolor
else
flashlinks[i].style.color=''
}
else if (flashtype==1){
if (flashlinks[i].style.backgroundColor!=flashcolor)
flashlinks[i].style.backgroundColor=flashcolor
else
flashlinks[i].style.backgroundColor=''
}
}
}

function init(){
var i=0
if (document.all){
while (eval("document.all.flashlink"+i)!=null){
flashlinks[i]= eval("document.all.flashlink"+i)
i++
} 
}
else if (document.getElementById){
while (document.getElementById("flashlink"+i)!=null){
flashlinks[i]= document.getElementById("flashlink"+i)
i++
}
}
setInterval("changelinkcolor()", 1000)
}

if (window.addEventListener)
window.addEventListener("load", init, false)
else if (window.attachEvent)
window.attachEvent("onload", init)
else if (document.all)
window.onload=init

			

function whichBrs() {
var agt=navigator.userAgent.toLowerCase();
if (agt.indexOf("opera") != -1) return 'Opera';
if (agt.indexOf("staroffice") != -1) return 'Star Office';
if (agt.indexOf("webtv") != -1) return 'WebTV';
if (agt.indexOf("beonex") != -1) return 'Beonex';
if (agt.indexOf("chimera") != -1) return 'Chimera';
if (agt.indexOf("netpositive") != -1) return 'NetPositive';
if (agt.indexOf("phoenix") != -1) return 'Phoenix';
if (agt.indexOf("firefox") != -1) return 'Firefox';
if (agt.indexOf("safari") != -1) return 'Safari';
if (agt.indexOf("skipstone") != -1) return 'SkipStone';
if (agt.indexOf("msie") != -1) return 'Internet Explorer';
if (agt.indexOf("netscape") != -1) return 'Netscape';
if (agt.indexOf("mozilla/5.0") != -1) return 'Mozilla';
if (agt.indexOf('\/') != -1) {
if (agt.substr(0,agt.indexOf('\/')) != 'mozilla') {
return navigator.userAgent.substr(0,agt.indexOf('\/'));}
else return 'Netscape';} else if (agt.indexOf(' ') != -1)
return navigator.userAgent.substr(0,agt.indexOf(' '));
else return navigator.userAgent;
}