﻿
function updateClock ( )
{
  var currentTime = new Date ( );

  var currentHours = currentTime.getHours ( );
  var currentMinutes = currentTime.getMinutes ( );
  var currentSeconds = currentTime.getSeconds ( );

  // Pad the minutes and seconds with leading zeros, if required
  currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
  currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;

  // Choose either "AM" or "PM" as appropriate
  var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";

  // Convert the hours component to 12-hour format if needed
  currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;

  // Convert an hours component of "0" to "12"
  currentHours = ( currentHours == 0 ) ? 12 : currentHours;

  // Compose the string for display
  var currentTimeString = currentHours + ":" + currentMinutes + ":" + currentSeconds + " " + timeOfDay;

  // Update the time display
  document.getElementById("clock").firstChild.nodeValue = currentTimeString;
}

function loadContentPage(contentPageName, categoryType, currentPageTitle)
{
	//Hide current links
	$(".contentNavLink").css({'display':'none'});
	
	if(categoryType!= null)
	{
		$("#lnk" + categoryType).css({'display':'inline'});
	}
	
    $("#lblContentPageTitle").html(currentPageTitle);

	loadPage = 'content/' + contentPageName+ '.html';
	$("#contentPageContent").load(loadPage);
	$("#toolTipBox").css({ 'display': 'none' });
	$("#pager").css({ 'display': 'none' });
}

function settitle(type)
{
    var pager = null;
	switch(type){	
	case 'home':
	    title = 'Welcome to Pocket Worlds';
	    text = 'Pocket Worlds specializes in the development and implementation of advanced mobile solutions.';
	    break;
	case 'services':
	    title = 'Interactive Services';
	    text = 'Pocket Worlds Ltd. provides a platform (IVR,SMS,WAP) for operating interactive services with the endusers.';
	    pager = '<img src="images/pager_2.png">';
	    break;
	case 'development':
	    title = 'Application Development';
	    text = 'Pocket Worlds Ltd. specializes in developing customizable applications for the Web and mobile phones.';
	    pager = '<img src="images/pager_1.png">';
	    break;
	case 'mobilemarketing':
	    title = 'Mobile Marketing';
	    text = 'A range of solutions for focused marketing and for call to action in an independent campaign or as a complement to those campaigns running in traditional media.';
	    pager = '<img src="images/pager_3.png">';
	    break;
	case 'mobiletools':
	    title = 'Mobile Tools';
	    text = 'A variety of mobile products that enrich and empower your website.';
	    pager = '<img src="images/pager_4.png">';
	    break;
	}

	$('#msgboxtitle').html(title);
	$('#msgboxtext').html(text);
	$('#toolTipBox').css({ 'display': 'block' });

    if (pager != null) {
        $("#pager").css({ 'display': 'block' });
        $('#pager').html(pager);
    }
    else {
        $("#pager").css({ 'display': 'none' });
    }
}

function showUrl(url) {
    window.open(url);
}

function showImage(image) {
    window.open("images/clients/" + image);
}


function hideURLbar() {
        window.scrollTo(0, 1);
}
