/*
//////////////////////////////////////////////////////////////////////////////
//	
//	Name:-        nc_gemoney.js
//	Location:-	  common/js
//	Description:- This  js file is included in the DCT's related to Core components.
//  Functions Included  : Yes.
//////////////////////////////////////////////////////////////////////////////
*/

function includeJS(src,cache) {
  
   var head = document.getElementsByTagName("head")[0];
   script = document.createElement('script');
   script.type = 'text/javascript';
   script.src = src;
   if (typeof(cache) != "undefined" && cache == false) {
	   var t = new Date();
	   var tt = t.getTime();
	   script.src += '?nocache='+tt; 
   }
   head.appendChild(script);
 }



// Start of Functions for Shortcut_Box Component

function clickOpenWindow()
{
		var selectedURL =  document.getElementById('selectSB').value;
                  var url = selectedURL.substr(0,selectedURL.indexOf('*'));
                  var target = selectedURL.substr(selectedURL.indexOf('*')+1,selectedURL.length);
		if(target == 'Same')
                  {
			window.open(url,'_self');
		}
		else
                  {
			window.open(url,'_blank');
		}
}
function changeOpenWindow(){
	if (document.selectBox.imgGo == null)
	{
			clickOpenWindow();
	}
}
// End of Functions for Shortcut_Box Component

// start of Fnctions for Collapsible_Teaser Component

currentdiv = '';
previousImg = '';
previousImgPath = '';
	function detailswitch(whichdiv,currentImgID, selectedImg){
		details = document.getElementById(whichdiv);
		if(currentdiv != ''){
			currenttohide = document.getElementById(currentdiv);
			currenttohide.style.display = 'none';
			if(previousImg !=''){
				document.images[previousImg].src = previousImgPath;
			}
		}
		if(currentdiv != whichdiv){
			details.style.display = 'block';
			currentdiv = whichdiv;
			if(selectedImg != '') {
				previousImg = currentImgID;
				previousImgPath = document.images[currentImgID].src
				document.images[currentImgID].src = selectedImg;
			}
		}
		else {
			currentdiv = '';
			previousImg = '';
		}
	}
// End of Functions for Collapsible_Teaser Component

function init(pos) {
//alert("Inside the init--> "+pos);
var srcArray= new Array(5);
srcArray[0] = new Array(2);
srcArray[0][0]="Image";
srcArray[0][1]="/img/521806_interactive_tools_p.jpg";
srcArray[1] = new Array(2);
srcArray[1][0]="Image";
srcArray[1][1]="/img/451387_1.3.1.jpg";
srcArray[2] = new Array(2);
srcArray[2][0]="Text";
srcArray[2][1]="This is the Text";
srcArray[3] = new Array(2);
srcArray[3][0]="Flash";
srcArray[3][1]="/img/259005_Contact-Us6.jpg";
srcArray[4] = new Array(2);
srcArray[4][0]="Image";
srcArray[4][1]="/img/489706_budgeting_your_money.jpg";



//alert(imgObj);
	if(pos!=null && pos!="undefined")
	{
		alert("Double array -->"+srcArray[pos][0]);
		
		if(srcArray[parseInt(pos)][0] == "Image")
		{
			
			alert("Double array -->"+srcArray[pos][1]);
			var textObj =document.getElementById("TextComp");
			textObj.style.display='none';
			var flashObj =document.getElementById("flashCom");
			flashObj.style.display='none';
			var imgObj =document.getElementById("banner");
			imgObj.style.display='block';
			imgObj.src = srcArray[pos][1];
		}else if(srcArray[pos][0] == "Flash")
		{
			var imgObj =document.getElementById("banner");
			var flashObj =document.getElementById("flashCom");
			imgObj.style.display='none';
			var textObj =document.getElementById("TextComp");
			textObj.style.display='none';
			flashObj.style.display='block';
		}else if(srcArray[pos][0] == "Text")
		{
			var imgObj =document.getElementById("banner");
			var flashObj =document.getElementById("flashCom");
			var textObj =document.getElementById("TextComp");
			imgObj.style.display='none';
			flashObj.style.display='none';
			textObj.style.display='block';
			textObj.innerHTML=srcArray[pos][1];
		}
	}

}
/*Function for the dynamic content in http://www.gemoney.com.au/en/customer_service/credit_cards.html*/
function showForms(productName) {
	document.getElementById(productName).style.display = "";
}
/* end function */

/* functions from http://as00.estara.com/as/InitiateCall2.php?accountid=200106290873*/

var wv_vars=typeof(wv_vars)=="undefined"?new Array():wv_vars;

wv_vars["ui_width"]="430";
wv_vars["ui_height"]="378";
wv_vars["ui_version"]="UI0001";
wv_vars["ui_newwindow"]="yes";
wv_vars["ui_accountid"]="200106290873";
wv_vars["ui_host"]="as00.estara.com";
wv_vars["ui_maxreferrer"]=600;
wv_vars["ui_window"]=null;
wv_vars["ui_host_param"]="";
if(typeof (eStara_startCobrowseGUINoFunc)=="undefined"){

var eStara_startCobrowseGUINoFunc=0;
}
wv_vars["ui_window"]=null;

function webCall(){

	if(wv_vars["ui_window"]==null||wv_vars["ui_window"].closed){
		var _1=arguments;
		_1[_1.length++]="calltype=webcall";
		wv_vars["ui_window"]=wv_start(_1);
	}
}
function webCallBack(){
	var _2=arguments;
	_2[_2.length++]="calltype=webcallback";
	wv_vars["ui_window"]=wv_start(_2);
}
function webVoicePop(){
	var _3=arguments;
	_3[_3.length++]="calltype=webvoicepop";
	wv_start(_3);
}
function webSurveyPop(){
	var _4=arguments;
	_4[_4.length++]="calltype=websurveypop";
	var _5=wv_vars["ui_width"];
	var _6=wv_vars["ui_height"];
	wv_vars["ui_width"]=640;
	wv_vars["ui_height"]=480;
	wv_vars["upload_only"]=1;
	wv_start(_4);
	wv_vars["ui_width"]=_5;
	wv_vars["ui_height"]=_6;
}
function wv_checklinkstatus(){

	var _7="0";
	for(var i=0;i<arguments.length;i++){
		
		var _9=arguments[i].toString();
		var _a=_9.indexOf("=");
		if(_a!=-1){
			var _b=(_9.substring(0,_a)).toLowerCase();
			var _c=_9.substring(_a+1,_9.length);
			switch(_b){
				case "template":_7=_c;
				break;
			}
		}
	}
	
	if((typeof (wv_available_vars)!="undefined")&&(typeof (wv_available_vars[_7])!="undefined")){
		return wv_available_vars[_7];
	}
	else{
		return false;
	}
}
function wv_start(a){
	var _e="webVoiceWindow";
	var _f=(window.location).toString();
	var _10=escape(_f);
	if(_10.length>wv_vars["ui_maxreferrer"]){
		var _11=_f.indexOf("?");
		_f=_11>0?_f.substring(0,_11)+"---TRUNCATED":"UNAVAILABLE - URL IS TOO LONG";
		_10=escape(_f);
		if(_10.length>wv_vars["ui_maxreferrer"]){
			_f="UNAVAILABLE - URL IS TOO LONG";
		}
	}
	var _12=typeof (document.title)!="undefined"?document.title:"UNKNOWN";
	if(escape(_12).toString().length>255){
		_12=(document.title).toString().substring(0,243)+"---TRUNCATED";
	}
	var _13=escape(_12);
	if(_13.length>350){
		_12="UNAVAILABLE - TITLE IS TOO LONG";
	}
	var _14=wv_vars["ui_newwindow"];
	var _15=wv_vars["ui_width"];
	var _16=wv_vars["ui_height"];
	var _17=wv_vars["ui_version"];
	var _18=wv_vars["ui_accountid"];
	var _19="";
	var _1a="";
	var _1b="";
	var _1c="";
	var _1d=(typeof (document.location.protocol)!="undefined"&&document.location.protocol=="file:")?"http":"";
	for(var i=0;i<a.length;i++){
		var _1f=a[i].toString();
		var _20=_1f.indexOf("=");
		if(_20!=-1){
			var _21=(_1f.substring(0,_20)).toLowerCase();
			var _22=_1f.substring(_20+1,_1f.length);
			switch(_21){
				case "wndname":_e=_22;
				break;
				case "referrer":_f=_22;
				break;
				case "pagetitle":_12=_22;
				break;
				case "newwindow":_14=_22;
				break;
				case "width":_15=_22;
				break;
				case "height":_16=_22;
				break;
				case "accountid":_18=_22;
				break;
				case "wv_ui":_17=_22;
				break;
				case "features":_19=_22;
				break;
				case "baseurl":_1a=_22;
				break;
				case "protocol":_1d=_22;
				break;
				case "template":_1b=_22;
				_1c+="&"+_21+"="+escape(_22);
				break;
				case "ppwinname":if(_22==""){
						_22="PagePushWindow"+(new Date()).getTime()+Math.round(Math.random()*1000000);
						this.name=_22;
					}
				default:_1c+="&"+_21+"="+escape(_22);
				break;
			}
		}else{
			alert("ERROR: Invalid argument passed to webXXX() function - Arg"+i+" is missing '=' sign : "+_1f);
			return null;
		}
	}
	if(typeof (eStara_startCobrowseGUI)=="function"){
		eStara_startCobrowseGUI((wv_vars["upload_only"]==1),_1b);
	}else{
		eStara_startCobrowseGUINoFunc=_1b;
	}
	for(var i=1;i<=10;i++){
		eval("var eStara_assigned=(typeof(eStara_var"+i+")!=\"undefined\"&&eStara_var"+i+"!=null)");
		if(eStara_assigned){
			eval("var eStara_tmp=\"&var"+i+"=\"+escape(eStara_var"+i+");");
			_1c+=eStara_tmp;
		}
	}
	if(typeof (eStara_fsguid)!="undefined"){
		_1c+="&estara_fsguid="+escape(eStara_fsguid);
	}
	if(_1d!=""){
		_1d+=":";
	}
	if(_1a==""){
		_1a=_1d+"//"+wv_vars["ui_host"]+"/UI/"+_17+"/"+_17+".php";
	}
	if(_19==""){
		_19="width="+_15+",height="+_16+",menubar=no,toolbar=no,directories=no,scrollbars=no,status=no,left=0,top=0,resizable=no";
	}
	_1c=_1a+(_1a.indexOf("?")==-1?"?":"&")+"donotcache="+escape((new Date()).getTime())+"&accountid="+escape(_18)+"&referrer="+escape(_f)+"&pagetitle="+escape(_12)+wv_vars["ui_host_param"]+_1c;
	if((typeof (wv_customurl)!="undefined")&&(typeof (wv_customurl[_1b])!="undefined")&&(wv_customurl[_1b]!="")){
	_1c=wv_customurl[_1b];
	}
	if((typeof (wv_customfeatures)!="undefined")&&(typeof (wv_customfeatures[_1b])!="undefined")&&(wv_customfeatures[_1b]!="")){
		_19=wv_customfeatures[_1b];
	}
	if(_14!="yes"){
		window.location=_1c;
	}else{
		try{
			var w=window.open(_1c,_e,_19);
			w.focus();
			return w;
		}catch(err){
		}
	}
	return null;
}

function webChatPop(){
	var wv_argscopy = arguments;
	wv_argscopy[wv_argscopy.length++]="wndname=eStaraChat_200106290873";
	wv_argscopy[wv_argscopy.length++]="calltype=webchatpop";
	var prev_ui_width=wv_vars["ui_width"];
	var prev_ui_height=wv_vars["ui_height"];
	wv_vars["ui_width"]=500;
	wv_vars["ui_height"]=500;
	wv_start(wv_argscopy);
	wv_vars["ui_width"]=prev_ui_width;
	wv_vars["ui_height"]=prev_ui_height;
}


/*end of functions from http://as00.estara.com/as/InitiateCall2.php?accountid=200106290873*/

/**pop up function 01*/
function openApplication(product) {
	if (screen.height && screen.width) {
		height = screen.height - 80;
	} else {
		height = 520;
	}

	if (product == "lowrate") {
		var theURL = "https://apply.gemoney.com.au/eapps/Apply.faces?cardType=lowrate" }

	if (product == "source") {
		var theURL = "https://apply.gemoney.com.au/eapps/Apply.faces?cardType=source" }

	if (product == "myer") {
		var theURL = "https://apply.gemoney.com.au/eapps/Apply.faces?cardType=myer" }	

	if (product == "eco") {
		var theURL = "https://apply.gemoney.com.au/eapps/Apply.faces?cardType=eco" }

	if (product == "wizard") {
		var theURL = "https://apply.wizard.com.au/eapps/Apply.faces?cardType=wizard" }

	if (product == "go") {
		var theURL = "https://apply.gomastercard.com.au/eapps/ApplyRetail.faces?cardType=go&merchant=ge" }

	var width = "622";
	var screenY = screen.height;
	var screenX = screen.width;
	var topvar = 0;
	var leftvar = (screenX - width) / 2;
 	window.open(theURL,'','resizable=no,scrollbars=yes,toolbar=no,menubar=no,location=no,status=yes,top='+topvar+',left='+leftvar+',width='+width+',height='+height+'');
}
/*end of pop up function 01*/