/* *
*  ------------------------------------------------
*  Square Circle scripts
*  Copyright (c) 2004-2006 Square Circle Solutions
*  www.sqcircle.com
*  Version: 1.0
*  ------------------------------------------------
*/


/**
* UPDATE HISTORY
*/
function sectionChange (sectionID) 
{ 
	var sectionName, display;

	switch (sectionID)
	{
		
		case 1:
		{
			sectionName = ": Portfolio";
			break;
		}
		case 2:
		{
			sectionName = ": About Us";
			break;
		}
		case 3:
		{
			sectionName = ": News";
			break;
		}
		case 4:
		{
			sectionName = ": Contact Us";
			break;
		}
		case 5:
		{
			sectionName = ": Case Studies";
			break;
		}
		case 6:
		{
			sectionName = ": Showreel";
			break;
		}
		case 7:
		{
			sectionName = ": Contact Downloads";
			break;
		}
		default:
		{
			sectionName = "";
			break;
		}
	}
	
 	
	//alert ("[index.php].sectionChange: " + sectionID + "\n" + sectionName);
	
	document.title = "Square Circle " + sectionName + " : +44 (0) 207 324 7554 : info@sqcircle.com";
	
	var iframe = document.getElementById('historyFrame');
 	iframe.src = 'history.php?page='+sectionID; 
    //iframe.reload();  
}









/**
*	WINDOW STATUS DISPLAY
*/
var statusMsg;
var STATUS_INT = 50;
var statusIntID;


function setStatusBarMsg()
{
	window.status = statusMsg;
}



function setStatusBar(arg)
{
	// window.status = arg;
	clearInterval(statusIntID);
	if(arg != "")
	{
		statusMsg = arg;
		statusIntID = setInterval("setStatusBarMsg()", STATUS_INT);
	}
}


function clearStatusBar()
{
	clearInterval(statusIntID);
	window.status = '';
}







/**
*	SKYPE RELATED
*/


var activex = ((navigator.userAgent.indexOf('Win')  != -1) && (navigator.userAgent.indexOf('MSIE') != -1) && (parseInt(navigator.appVersion) >= 4 ));
var CantDetect = ((navigator.userAgent.indexOf('Safari')  != -1) || (navigator.userAgent.indexOf('Opera')  != -1));


function skypeUs ()
{   
       
		if(CantDetect) 
		{
			document.location = "skype:sqcircle?call ";
		}
		   
	   
	   else if(!activex) 
		{
	   
		   var skypeMime = navigator.mimeTypes["application/x-skype"];
			
			if(typeof(skypeMime) == "object") 
			{
			   document.location = "skype:sqcircle?call ";
			} 
			
		else 
			{
				return oopsPopup();
			}
		
		}
		
		else 
		{
        if(isSkypeInstalled()) 
		{
      		document.location = "skype:sqcircle?call ";
        }
    }
		
		
}


function oopsPopup() {
	var windowName = "oops";
	var URLtoOpen = "http://download.skype.com/share/skypebuttons/oops/oops.html";
	var popW = 540, popH = 305;
	var scrollB = 'no';
	w = screen.availWidth;
	h = screen.availHeight;
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;
	oopswindow = window.open(URLtoOpen, windowName,'width=' + popW + ',height=' + popH + ',scrollbars=' + scrollB + ',screenx=' +leftPos +',screeny=' +topPos +',top=' +topPos +',left=' +leftPos);
}

if(typeof(detected) == "undefined" && activex) {
    document.write(
        ['<script language="VBscript">',
        'Function isSkypeInstalled()',
        'on error resume next',
        'Set oSkype = CreateObject("Skype.Detection")',
        'isSkypeInstalled = IsObject(oSkype)',
        'Set oSkype = nothing',
        'End Function',
        '</script>'].join("\n")
    );
}

