// JavaScript Document

var cc_cardcontents = new Array();
	cc_cardcontents[0] = "rewards";
	cc_cardcontents[1] = "privileges";
	cc_cardcontents[2] = "features";
	cc_cardcontents[3] = "promotions";
	cc_cardcontents[4] = "details";

function cc_common_hideElement(id) {
	//safe function to hide an element with a specified id

	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function cc_common_showElement(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}

function cc_common_reset_btn(g3n3pix)
{
	for (i=0;i<cc_cardcontents.length;i++)
	{
		imgsrc = '/sg/personal/cards/common/images/'+g3n3pix+'_sub'+cc_cardcontents[i]+'.gif';
		document.getElementById('btn_'+cc_cardcontents[i]).setAttribute("src",imgsrc);
		//document.write(imgsrc+'<br>');
	}
}

function cc_common_close_contents()
{
	for (i=0;i<cc_cardcontents.length;i++)
	{
		cc_common_hideElement('content'+cc_cardcontents[i])
	}
	
}

function cc_common_show_btn(id,g3n3pix)
{
	imgsrc = '/sg/personal/cards/common/images/'+g3n3pix+'_sub'+id+'_o.gif';
	document.getElementById('btn_'+id).setAttribute("src",imgsrc);
}

function cc_common_show_content(id)
{
	cc_common_showElement('content'+id);
}

//add default.aspx for DBS environment
function switch_content(id,g3n3pix)
{	
	var address = top.document.location.protocol + "//" +
		  top.document.location.host +
		  top.document.location.pathname +
		  '#' + id + '&' + g3n3pix;			  
	location.replace(address); 

	cc_common_reset_btn(g3n3pix);
	cc_common_show_btn(id,g3n3pix);
	cc_common_close_contents();
	cc_common_show_content(id,g3n3pix);		
}


function cc_common_cards_deeplink(){
if (location.href.indexOf("#") != -1) {
cardsec = "";

	if (location.href.indexOf("cardall") != -1){
			  cardsec = "cardall";
			}
	if (location.href.indexOf("cardaltitude") != -1){
			  cardsec = "cardaltitude";
			}
	if (location.href.indexOf("cardblack") != -1){
			  cardsec = "cardblack";
			}
	if (location.href.indexOf("cardlive") != -1){
			  cardsec = "cardlive";
			}
	if (location.href.indexOf("cardwoman") != -1){
			  cardsec = "cardwoman";
			}

if (cardsec != "") {
        if (location.href.indexOf("rewards") != -1){
		  switch_content('rewards',cardsec);
		}
	if (location.href.indexOf("privileges") != -1){
		  switch_content('privileges',cardsec);
		}
	if (location.href.indexOf("features") != -1){
		  switch_content('features',cardsec);
		}
	if (location.href.indexOf("promotions") != -1){
		  switch_content('promotions',cardsec);
		}
	if (location.href.indexOf("details") != -1){
		  switch_content('details',cardsec);
		}
}
}
}

