// usage:  <script type="text/javascript">countdown_clock(06, 12, 25, 00, 00, 1);</script>
function countdown_clock(year, month, day, hour, minute, format,text_color,time_color)
         {
         //I chose a div as the container for the timer, but
         //it can be an input tag inside a form, or anything
         //who's displayed content can be changed through
         //client-side scripting.
         html_code = '<div id="countdown"></div>';
         
         document.write(html_code);
         
         countdown(year, month, day, hour, minute, format,text_color,time_color);                
         }
         
function countdown(year, month, day, hour, minute, format,text_color,time_color)
         {
         Today = new Date();
         Todays_Year = Today.getFullYear() - 2000;
         Todays_Month = Today.getMonth() + 1;                  
         
         //Convert both today's date and the target date into miliseconds.                           
         Todays_Date = (new Date(Todays_Year, Todays_Month, Today.getDate(), 
                                 Today.getHours(), Today.getMinutes(), Today.getSeconds())).getTime();                                 
         Target_Date = (new Date(year, month, day, hour, minute, 00)).getTime();                  
         
         //Find their difference, and convert that into seconds.                  
         Time_Left = Math.round((Target_Date - Todays_Date) / 1000);
         
         if(Time_Left < 0)
            Time_Left = 0;
         
         switch(format)
               {
               case 0:
                    //The simplest way to display the time left.
                    document.all.countdown.innerHTML = Time_Left + ' seconds';
                    break;
               case 1:
                    //More datailed.
                    days = Math.floor(Time_Left / (60 * 60 * 24));
                    Time_Left %= (60 * 60 * 24);
                    hours = Math.floor(Time_Left / (60 * 60));
                    Time_Left %= (60 * 60);
                    minutes = Math.floor(Time_Left / 60);
                    Time_Left %= 60;
                    seconds = Time_Left;
					// for formatting
					textColor = '<font color=' + text_color + '>';
					timeColor = '<font color=' + time_color + '>';
					endFont = '</font>';
                    //
                    dps = 'S'; hps = 'S'; mps = 'S'; sps = 'S';
                    //ps is short for plural suffix.
                    if(days == 1) dps ='';
                    if(hours == 1) hps ='';
                    if(minutes == 1) mps ='';
                    if(seconds == 1) sps ='';
                    

                    var strHTML = '&nbsp;&nbsp;' + timeColor + days + endFont;
					strHTML += textColor + ' DAY' + dps + ' ' + endFont;
                    strHTML += timeColor + hours + endFont;
					strHTML += textColor + ' HR' + hps + ' ' + endFont;
                    strHTML += timeColor + minutes + endFont;
					//strHTML += textColor + ' MINUTE' + mps + ' and ' + endFont;
					strHTML += textColor + ' MIN' + mps + ' ' + endFont;
                    strHTML += timeColor + seconds + endFont;
					strHTML += textColor + ' SEC' + sps + endFont + '&nbsp;&nbsp;';
					
					element = document.getElementById('countdown');
					element.innerHTML = strHTML;
                    break;
               default: 
                    document.all.countdown.innerHTML = Time_Left + ' seconds';
               }
               
         //Recursive call, keeps the clock ticking.  ,text_color,time_color
         setTimeout('countdown(' + year + ',' + month + ',' + day + ',' + hour + ',' + minute + ',' + format + ',\'' + text_color + '\',\'' + time_color + '\');', 1000);
         }
function openExtLink(URL) {
	day = new Date();
	var id = "page" + day.getTime();
	eval(id + " = window.open(URL, '" + id + "', 'resizable=1,scrollbars=yes,width=800,height=600,left = 5,top = 5');");
	//id.focus();
}
function clickButton(e, buttonid){ 
      var bt = document.getElementById(buttonid); 
      if (typeof bt == 'object'){ 
            if(navigator.appName.indexOf("Netscape")>(-1)){ 
                  if (e.keyCode == 13){ 
                        bt.click(); 
                        return false; 
                  } 
            } 
            if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1)){ 
                  if (event.keyCode == 13){ 
                        bt.click(); 
                        return false; 
                  } 
            } 
      } 
}
function popUp(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'resizable=1,width=300,height=200,left = 357.5,top = 464.5');");
}
	
function popUp2(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'resizable=1,width=300,height=200,left = 357.5,top = 464.5');");
}
function popUp_500(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=550,left = 0,top = 0');");
}
function popUpAgent(URL) {
	day = new Date();
	id = day.getTime();
	path = 'http://www.nex-techwireless.com/applicationdata/1/pix/Agents/';
	URL = path + URL;
	eval("page" + id + " = window.open(URL, '" + id + "', 'resizable=1,width=300,height=200,left = 357.5,top = 464.5');");
}
function ShowImage(imgName){
	//syntax <img id=\"pictures\" width=\"250\" src=\"" + ipath + images[0] + "\" onClick=\"ShowImage(pictures.src);\" alt=\"Click to view\">
	var ar = new Image;
	ar.src = imgName;
	var myWinWidth=ar.width;
	var myWinHeight=ar.height;
	if (myWinWidth>500)
		{
			var ratio = myWinWidth/myWinHeight;
			myWinWidth = 640;
			myWinHeight = 640/ratio;
		}
	var theUrl="Nex-techPics.html";
	var myWin = window.open(theUrl,'myWin','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=' + myWinWidth + ',height=' + myWinHeight + ',top=0,left=0');
	myWin.document.write("<img src=\"" + imgName + "\" width=\"100%\">");
	myWin.focus();
}
function ShowImageScroll(imgName){
	//syntax <img id=\"pictures\" width=\"250\" src=\"" + ipath + images[0] + "\" onClick=\"ShowImage(pictures.src);\" alt=\"Click to view\">
	var ar = new Image;
	ar.src = imgName;
	var myWinWidth= 1.1 * ar.width;
	var myWinHeight= 1.1 * ar.height;
	if (myWinWidth>500)
		{
			var ratio = myWinWidth/myWinHeight;
			myWinWidth = 640;
			myWinHeight = 640/ratio;
		}
	var theUrl="Nex-TechPics.html";
	var myWin = window.open(theUrl,'myWin','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=' + myWinWidth + ',height=' + myWinHeight + ',top=0,left=0');
	myWin.document.write("<img src=\"" + imgName + "\" width=\"100%\">");
	myWin.focus();
}
function ShowMap(imgName) {
	imgPath = "http://www.nex-techwireless.com/applicationdata/1/pix/" + imgName;
	var ar = new Image;
	ar.src = imgPath;
	//alert(imgPath);
	var myWinWidth=1.1 * ar.width;
	var myWinHeight=1.1 * ar.height;
	if(myWinWidth < 100)
	{
		myWinWidth = 640;
		myWinHeight = 480;
	}
	if (myWinWidth>5000)
		{
			var ratio = myWinWidth/myWinHeight;
			myWinWidth = 640;
			myWinHeight = 640/ratio;
		}	
	var myWin = window.open(imgPath,'myWin','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=' + myWinWidth + ',height=' + myWinHeight + ',top=0,left=0');
	myWin.focus();
	//alert(imgPath);
}
function ShowImageAd(imgId){
	//syntax <img id=\"pictures\" width=\"250\" src=\"" + ipath + images[0] + "\" onClick=\"ShowImageAd('pictures');\" alt=\"Click to view\">
	var ar = document.getElementById(imgId); 
	var myWinWidth=ar.width;
	var myWinHeight=ar.height;
	var theUrl="Nex-techPics.html";
	var myWin = window.open(theUrl,'myWin','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=' + myWinWidth + ',height=' + myWinHeight + ',top=0,left=0');
	myWin.document.write("<img src=\"" + imgName + "\" width=\"100%\">");
	myWin.focus();
}
function bookmarkpage(bookmark, url){
// example <a href="javascript:bookmarkpage('Nex-Tech Ad','http://www.nex-techwireless.com/FreeClassifieds.aspx')">Bookmark this ad!</a>
if (document.all)
window.external.AddFavorite(url, bookmark);
else if (window.sidebar)
window.sidebar.addPanel(bookmark, url, "");
}