// GENERAL AND NOT SO GENERAL STUFF
// ADD... DON'T REMOVE! ... AT THE END, IT'S A CHAOS ANYWAY

function CentreWindow(mypage, myname, w, h, scroll, toolbar) {
	var winl = ((screen.width - w) / 2) - 0;
	var wint = ((screen.height - h) / 2) - 0;
	if(toolbar==undefined){
		toolbar="no";	
	}
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',toolbar='+toolbar+',resizable=no,status=no'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
	win.window.focus();
}

function openStoreLocator(){
  //CentreWindow('http://www.diesel.com/stores_contacts/index.html','Stores','418','400','no');
  CentreWindow('http://www.diesel.com/storelocator/','Stores','740','350','no');
}
function getTheFlyer(){
  //CentreWindow('http://www.diesel.com/stores_contacts/index.html','Stores','418','400','no');
  CentreWindow('http://www.diesel.com/cult/web/uploads/noticias/flyer.php','Flyer','580','594','no', 'yes');
}

function joinTheCult(){
  //CentreWindow('http://www.diesel.com/movement/register.cgi','Join','657','520','yes');
//  CentreWindow('http://www.diesel.com/jointhecult','Join','700','520','yes');
  window.open("http://www.diesel.com/index.php?page=cult");
}
function reportCult(){
  CentreWindow('http://www.diesel.com/cult/web/report_dsl.php','Report','350','400','yes');

}

function resizeBrowser(width, height){
	window.resizeTo(width, height)
}

function openFashionShow(){
	window.location.href = "http://www.diesel.com/fashionshow/fw06/";
	//CentreWindow('http://www.diesel.com/fashionshow/fw06/', 'DIESEL', '1024', '768', 'no');
}

function openTerms(idioma){
	CentreWindow('legalterms_'+idioma+'.html', 'DIESEL', '380', '400', 'yes');
}

function legal_pressinfo(idioma){
	CentreWindow('legalpress_'+idioma+'.html', 'DIESEL', '380', '400', 'yes');
}

function boule(idioma){
	CentreWindow('legalterms_'+idioma+'.html#Boule', 'DIESEL', '380', '400', 'yes');
}

function goDieselHome(){
	var country1 = getQueryVariable("country").toLowerCase();
	var country2 = getQueryVariable("ref").toLowerCase();
	if(country1=="japan" || country2=="jp"){
		window.location.href = "http://www.diesel.co.jp/"
	}else{
		window.location.href = "http://www.diesel.com/"
	}
	
}

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];
    }
  }
  return "";
}