function launchApp(product, chipname, index, filter){	
	var path = "http://www2.dupont.com/Surfaces_Commercial/en_US/assets/flash/gallery_com/";
	var apps = ["colors", "gallery", "designer", "estimator", "selector"];
	var b = "corian";
	product = (product != undefined) ? product : "c";
	if(product.toLowerCase() == "z"){
		b = "zodiaq";
	}
	else{
		b = "corian";
	}
	var url = path + apps[index] + ".html?product=" + b;
	if(chipname){
		url += "&chipname=" + chipname;
	}
	if(filter){
		url += "&filter=" + filter;
	}	
	openWin( url );
}

function openWin( url ){
//alert(url);
newWin = window.open( url, "newWin", "resizable=no,scrollbars=no,status,height=500,width=785" );
	if( !newWin || newWin.closed ){
		newWin = window.open( url, "newWin", "resizable=no,scrollbars=no,status,height=500,width=785" );
	}else{
		newWin.location.href = url;
	}			
	newWin.focus();
}

function closeWin(){
	window.close();
}

function linkOpener( url, target ){
	if(target == "SELF"){
		window.location.href = url;
	}else{
		if(window.opener != null && !window.opener.closed){
			window.opener.location.href = url;
			window.opener.focus();
		}else{
			var win =  window.open(url, "win");
			win.focus();
		}

	}

}

function getQueryVariable(variable){
	var query = window.location.search.substring(1);
	var vars = query.split("&");
	for(var i = 0; i < vars.length; i++){
		var pair = vars[i].split("=");
		if(pair[0] == variable){
			return pair[1];
		}
	}
}

function loadEstimator( url ){
     window.location.href = url;
}


function showMsg(msg) {
	alert(msg);
}