/*
 * 
 * Author: Gary Paul Smith
 * Date: 10-09-2009
 * 
 * Copyright (c) 2009 ASPECT4
 * 
 * Description:
 * 
 * 
 * 
 */ 
 
var MM_contentVersion = 3;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
var backgrnd="#000000";

// new window function
var newWindow = null;
function openWindow(theURL,winName,features) {
	// check if new window exists
	if (!newWindow || newWindow.closed) {
		// open window and size to fit screen
		newWindow = window.open(theURL,winName,features);
		} else {
		// bring window into focus instead
		newWindow.focus()
		}
}

image0 = new Image();
image1 = new Image();

function image_click(clicks)
{
	if(clicks==0) login();
	if(clicks==1) gotoAssist();
}

 var newWebshop = null;

function webshop(param)
{
	if (!newWebshop || newWebshop.closed) {
		// open window and size to fit screen
		newWindow = window.open('http://www.bestilher.dk' + param,'webshop','toolbar=1,location=1,status=1,menubar=1,resizable=1,scrollbars=1');
		} else {
		// bring window into focus instead
		newWebshop.focus()
	}
}

function login()
{
  openWindow('http://kundeportal.edbgruppen.dk','kundeportal','toolbar=1,location=1,status=1,menubar=1,resizable=1,scrollbars=1');
}

function gotoAssist()
{
  popupNoScrollBar("http://www.gotoassist.com/ph/Aspect4401", "ASPECT4 Live Chat - Powered by GotoAssist", 800, 450); 
}


function popUp(url,wintitle,width, height,resize){
	var centerX=(screen.width-width)/2; //Need to subtract the window width/height so that it appears centered. If you didn't, the top left corner of the window would be centered. 
	var centerY=(screen.height-height)/2; 
	if (resize) {
		window.open(url, wintitle, 'resizable=1,width='+width+',height='+height+',left='+centerX+',top='+centerY); 
	} else {
		window.open(url, wintitle, 'width='+width+',height='+height+',left='+centerX+',top='+centerY); 
	}
}

/*
function popUp(url,wintitle,width, height){
	var centerX=(screen.width-width)/2; //Need to subtract the window width/height so that it appears centered. If you didn't, the top left corner of the window would be centered. 
	var centerY=(screen.height-height)/2; 
	//window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width="+ width +",height=" + height + ",left =" + rect[0] +",top =" + rect[1] +"');");
	window.open(url, wintitle, 'width='+width+',height='+height+',left='+centerX+',top='+centerY); 
}
*/

function popitup(url)
{
	newwindow=window.open(url,'name','resizable=1,height=200,width=200');
	if (window.focus) {newwindow.focus()}
	return false;
}


function popupNoScrollBar(url, title, width, height) {
	newwindow=window.open(url, null, "width=" + width + ",height=" + height + ",scrollbars=no,toolbar=no;locationbar=no;statusbar=no,resizable=yes");
	if (window.focus) {newwindow.focus()}
	return false;
}


function MM_jumpMenu(targ,selObj,restore){ //v3.0
  var subportalurl = selObj.options[selObj.selectedIndex].value;
  popupNoScrollBar(subportalurl, "ASPECT4 Live Chat - Powered by GotoAssist", 700, 800); 
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}
	
// ASPECT4 LiveChat
function resetPhoneCode(){
	// alert("hello");
	document.forms[1].phonecode.value ="";
}

function startPhonemode(){
	// phonemodeurl = "http://www.gotoassist.com/ph/edbgruppen2"; 
	//phonemodeurl = "https://broker.gotoassist.com/h/edbgruppen2?Question=DR" + document.forms[1].phonecode.value;
	var pcode = document.forms[1].phonecode.value;
	checkPhoneModeCode(pcode);
	/*
		phonemodeurl = "https://broker.gotoassist.com/h/edb-phone?Question=DR" + document.forms[1].phonecode.value;
		document.forms[1].phonecode.value ="[Indtast kode]";
		popupNoScrollBar(phonemodeurl, null, 756, 450);
	*/
}

// Check to see if ASPECT4 or another Business Unit
function checkPhoneModeCode(pcode){
	var phcode = pcode.toLowerCase();
	var cCheck=phcode.indexOf('eg');
	if(cCheck == -1){
		// ASPECT4 code
		phonemodeurl = "https://broker.gotoassist.com/h/edb-phone?Question=DR" + document.forms[1].phonecode.value;
		document.forms[1].phonecode.value ="[Indtast kode]";
		popupNoScrollBar(phonemodeurl, null, 756, 450);
	}
	else {
		// EG Code
		var stripCode = phcode.substring(2,phcode.length);
		phonemodeurl = "https://broker.gotoassist.com/h/edbgruppen2?Question=DR" + stripCode;
		document.forms[1].phonecode.value ="[Indtast kode]";
		popupNoScrollBar(phonemodeurl, null, 756, 450);
	}
}

function openUrl(url){
	newwindow=window.open(url,'name','resizable=1,height=600,width=970,scrollbars=1');
	if (window.focus) {newwindow.focus()}
}

function openPDFDocWindow(url){
	newwindow=window.open(url,'name','resizable=1,height=600,width=800');
	if (window.focus) {newwindow.focus()}
}
