// JavaScript Document

// PREVENT JAVASCRIPT ERROR reporting - disable for debug
function stopError() {return true;}
//window.onerror = stopError;

//define domain
document.domain='lacasting.com';

// get filename and path
var thisPath = window.location.pathname;
var thisPage = thisPath.substring(thisPath.lastIndexOf('/frontend/')+1);
var pageName = thisPath.substring(thisPath.lastIndexOf('/')+1);
var findNav = pageName.substring(0,3);
var thisNav;

// find navigation
if(findNav=='hom'){
thisNav='home.asp';}
else if(findNav=='act'){
thisNav='act.asp';}
else if(findNav=='pro'){
thisNav='pro.asp';}
else if(findNav=='dc_'){
thisNav='dc.asp';}
else{ // default
thisNav='home.asp';}
//alert(thisNav);


// load page in iframe - prevents missing navigation
if (findNav!='new'){ // exclude networker temporarily
if (top.location.href == self.location.href) {
top.location.replace('/frontend/'+thisNav+'?content=/'+thisPage);}}




// insert google analytics to bottom of page
function insertAnalytics(){
var addScript = document.createElement('script');
addScript.type = 'text/javascript';
addScript.onload=initAnalytics;
addScript.src = 'http://www.google-analytics.com/urchin.js';
document.body.appendChild(addScript);
}

function initAnalytics(){
_uacct = 'UA-2067357-1'; // LA Casting	
// _uacct = 'UA-2067357-2'; // NY Casting
// _uacct = "UA-2067357-3"; // SF Casting
urchinTracker();
}

window.onload = function() {
	insertAnalytics();
	top.document.title=document.title;
}

function sendLogin(){
		document.login.action = 'http://login.lacasting.com/';
		document.login.target = '_top';
		document.login.submit();             
}

/*function photowin(page) {
photopage = page;
photoname = 'photos';

var winl = 0;
var wint = 0;
props = '';
props += 'top='+wint+',';
props += 'left='+winl+',';
props += 'width=730,';
props += 'height=520,';
props += 'scrollbars=yes,';
props += 'resizable=yes,';
props += 'menubar=no,';
props += 'toolbar=no,';
props += 'status=no,';
win = window.open(photopage, photoname, props)
}*/

function NewWindow(mypage, myname, w, h, sc, r, m, t, st) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2; //(screen.height - h) / 2
props = '';
props += 'top='+wint+',';
props += 'left='+winl+',';
props += 'width='+w+',';
props += 'height='+h+',';
props += 'scrollbars='+sc+',';
props += 'resizable='+r+',';
props += 'menubar='+m+',';
props += 'toolbar='+t+',';
props += 'status='+st+',';
win = window.open(mypage, myname, props)
win.focus();
}