
if(window.location.href.indexOf("http://www.labelyourcigar.com/product.php?id_product=40") > -1)
window.location.href = "http://www.labelyourcigar.com/cigar-samples/40-double-corona-habano.html";

if(window.location.href.indexOf("http://www.labelyourcigar.com/product.php?id_product=44") > -1)
window.location.href = "http://www.labelyourcigar.com/naked-bundles/44-double-corona-habano.html";

if(window.location.href.indexOf("http://www.labelyourcigar.com/product.php?id_product=13") > -1)
window.location.href = "http://www.labelyourcigar.com/personalized-cigars/13-torpedo-connecticut.html";

if(window.location.href.indexOf("http://www.labelyourcigar.com/product.php?id_product=40") > -1)
window.location.href = "http://www.labelyourcigar.com/cigar-samples/40-double-corona-habano.html";

if(window.location.href.indexOf("http://www.labelyourcigar.com/product.php?id_product=42") > -1)
window.location.href = "http://www.labelyourcigar.com/naked-bundles/42-churchill-habano.html";

if(window.location.href.indexOf("http://www.labelyourcigar.com/product.php?id_product=45") > -1)
window.location.href = "http://www.labelyourcigar.com/naked-bundles/45-robusto-connecticut.html";

if(window.location.href.indexOf("http://www.labelyourcigar.com/product.php?id_product=47") > -1)
window.location.href = "http://www.labelyourcigar.com/naked-bundles/47-toro-connecticut.html";

if(window.location.href.indexOf("http://www.labelyourcigar.com/product.php?id_product=50") > -1)
window.location.href = "http://www.labelyourcigar.com/naked-bundles/50-torpedo-habano.html";

if(window.location.href.indexOf("http://www.labelyourcigar.com/product.php?id_product=18") > -1)
window.location.href = "http://www.labelyourcigar.com/personalized-cigars/18-doble-corona-connecticut.html";

if(window.location.href.indexOf("http://www.labelyourcigar.com/product.php?id_product=34") > -1)
window.location.href = "http://www.labelyourcigar.com/cigar-samples/34-torpedo-connecticut.html";

if(window.location.href.indexOf("http://www.labelyourcigar.com/product.php?id_product=33") > -1)
window.location.href = "http://www.labelyourcigar.com/cigar-samples/33-torpedo-connecticut.html";

if(window.location.href.indexOf("http://www.labelyourcigar.com/product.php?id_product=19") > -1)
window.location.href = "http://www.labelyourcigar.com/personalized-cigars/19-double-corona-habano.html";

if(window.location.href.indexOf("http://www.labelyourcigar.com/product.php?id_product=49") > -1)
window.location.href = "http://www.labelyourcigar.com/naked-bundles/49-torpedo-connecticut.html";

if(window.location.href.indexOf("http://www.labelyourcigar.com/product.php?id_product=32") > -1)
window.location.href = "http://www.labelyourcigar.com/cigar-samples/32-robusto-connecticut.html";

if(window.location.href.indexOf("http://www.labelyourcigar.com/product.php?id_product=54") > -1)
window.location.href = "http://www.labelyourcigar.com/accessories/54-odor-eliminators.html";

if(window.location.href.indexOf("http://www.labelyourcigar.com/product.php?id_product=41") > -1)
window.location.href = "http://www.labelyourcigar.com/naked-bundles/41-churchill-connecticut.html";

if(window.location.href.indexOf("http://www.labelyourcigar.com/product.php?id_product=10") > -1)
window.location.href = "http://www.labelyourcigar.com/personalized-cigars/10-robusto-connecticut.html";

if(window.location.href.indexOf("http://www.labelyourcigar.com/product.php?id_product=38") > -1)
window.location.href = "http://www.labelyourcigar.com/cigar-samples/38-churchill-habano.html";

if(window.location.href.indexOf("http://www.labelyourcigar.com/product.php?id_product=12") > -1)
window.location.href = "http://www.labelyourcigar.com/personalized-cigars/12-torpedo-connecticut.html";

if(window.location.href.indexOf("http://www.labelyourcigar.com/product.php?id_product=55") > -1)
window.location.href = "http://www.labelyourcigar.com/accessories/55-green-apple-re-fresh-smoke-odor-eliminator.html";

if(window.location.href.indexOf("http://www.labelyourcigar.com/product.php?id_product=16") > -1)
window.location.href = "http://www.labelyourcigar.com/personalized-cigars/16-churchill-connecticut.html";

if(window.location.href.indexOf("http://www.labelyourcigar.com/product.php?id_product=31") > -1)
window.location.href = "http://www.labelyourcigar.com/cigar-samples/31-robusto-connecticut.html";

if(window.location.href.indexOf("http://www.labelyourcigar.com/product.php?id_product=48") > -1)
window.location.href = "http://www.labelyourcigar.com/naked-bundles/48-toro-habano.html";

if(window.location.href.indexOf("http://www.labelyourcigar.com/product.php?id_product=36") > -1)
window.location.href = "http://www.labelyourcigar.com/cigar-samples/36-toro-connecticut.html";

if(window.location.href.indexOf("http://www.labelyourcigar.com/product.php?id_product=14") > -1)
window.location.href = "http://www.labelyourcigar.com/personalized-cigars/14-toro-connecticut.html";

if(window.location.href.indexOf("http://www.labelyourcigar.com/product.php?id_product=35") > -1)
window.location.href = "http://www.labelyourcigar.com/cigar-samples/35-toro-habano.html";

if(window.location.href.indexOf("http://www.labelyourcigar.com/product.php?id_product=11") > -1)
window.location.href = "http://www.labelyourcigar.com/personalized-cigars/11-robusto-connecticut.html";

if(window.location.href.indexOf("http://www.labelyourcigar.com/product.php?id_product=15") > -1)
window.location.href = "http://www.labelyourcigar.com/personalized-cigars/15-toro-habano.html";

if(window.location.href.indexOf("http://www.labelyourcigar.com/product.php?id_product=46") > -1)
window.location.href = "http://www.labelyourcigar.com/naked-bundles/46-robusto-habano.html";

if(window.location.href.indexOf("http://www.labelyourcigar.com/product.php?id_product=37") > -1)
window.location.href = "http://www.labelyourcigar.com/cigar-samples/37-churchill-connecticut.html";

if(window.location.href.indexOf("http://www.labelyourcigar.com/product.php?id_product=17") > -1)
window.location.href = "http://www.labelyourcigar.com/personalized-cigars/17-churchill-habano.html";



if(window.location.href.indexOf("http://www.labelyourcigar.com/cms.php?id_cms=4") > -1)
window.location.href = "http://www.labelyourcigar.com/content/4-about-us";

if(window.location.href.indexOf("http://www.labelyourcigar.com/cms.php?id_cms=7") > -1)
window.location.href = "http://www.labelyourcigar.com/content/7-cigar-process";

if(window.location.href.indexOf("http://www.labelyourcigar.com/cms.php?id_cms=6") > -1)
window.location.href = "http://www.labelyourcigar.com/content/6-cigar-process";

if(window.location.href.indexOf("http://www.labelyourcigar.com/cms.php?id_cms=5") > -1)
window.location.href = "http://www.labelyourcigar.com/content/5-terms-and-conditions";

if(window.location.href.indexOf("http://www.labelyourcigar.com/category.php?id_category=9") > -1)
window.location.href = "http://www.labelyourcigar.com/9-personalized-cigar-bundle";

if(window.location.href.indexOf("http://www.labelyourcigar.com/category.php?id_category=12") > -1)
window.location.href = "http://www.labelyourcigar.com/12-cigar-samples";

if(window.location.href.indexOf("http://www.labelyourcigar.com/category.php?id_category=10") > -1)
window.location.href = "http://www.labelyourcigar.com/10-naked-bundles";



function	autoUrl(name, dest)
{
	var loc;
	var id_list;

	id_list = document.getElementById(name);
	loc = id_list.options[id_list.selectedIndex].value;
	if (loc != 0)
		location.href = dest+loc;
	return ;
}

function	autoUrlNoList(name, dest)
{
	var loc;

	loc = document.getElementById(name).checked;
	location.href = dest + (loc == true ? 1 : 0);
	return ;
}

/*
** show or hide element e depending on condition show
*/
function toggle(e, show)
{
	e.style.display = show ? '' : 'none';
}

function toggleMultiple(tab)
{
    var len = tab.length;

    for (var i = 0; i < len; i++)
        if (tab[i].style)
            toggle(tab[i], tab[i].style.display == 'none');
}

/**
* Show dynamicaly an element by changing the sytle "display" property
* depending on the option selected in a select.
*
* @param string $select_id id of the select who controls the display
* @param string $elem_id prefix id of the elements controlled by the select
*   the real id must be : 'elem_id'+nb with nb the corresponding number in the
*   select (starting with 0).
*/
function showElemFromSelect(select_id, elem_id)
{
	var select = document.getElementById(select_id);
	for (var i = 0; i < select.length; ++i)
	{
	    var elem = document.getElementById(elem_id + select.options[i].value);
		if (elem != null)
			toggle(elem, i == select.selectedIndex);
	}
}

/**
* Get all div with specified name and for each one (by id), toggle their visibility
*/
function openCloseAllDiv(name, option)
{
	var tab = $('*[name='+name+']');
	for (var i = 0; i < tab.length; ++i)
		toggle(tab[i], option);
}

/**
* Toggle the value of the element id_button between text1 and text2
*/
function toggleElemValue(id_button, text1, text2)
{
	var obj = document.getElementById(id_button);
	if (obj)
		obj.value = ((!obj.value || obj.value == text2) ? text1 : text2);
}

function addBookmark(url, title)
{
	if (window.sidebar)
		return window.sidebar.addPanel(title, url, "");
	else if ( window.external )
		return window.external.AddFavorite( url, title);
	else if (window.opera && window.print)
		return true;
	return true;
}

function writeBookmarkLink(url, title, text, img)
{
	var insert = '';
	if (img)
		insert = writeBookmarkLinkObject(url, title, '<img src="' + img + '" alt="' + escape(text) + '" title="' + escape(text) + '" />') + '&nbsp';
	insert += writeBookmarkLinkObject(url, title, text);
	document.write(insert);
}

function writeBookmarkLinkObject(url, title, insert)
{
	if (window.sidebar || window.external)
		return ('<a href="javascript:addBookmark(\'' + escape(url) + '\', \'' + escape(title) + '\')">' + insert + '</a>');
	else if (window.opera && window.print)
		return ('<a rel="sidebar" href="' + escape(url) + '" title="' + escape(title) + '">' + insert + '</a>');
	return ('');
}

function checkCustomizations()
{
	var tmp;
	var pattern = new RegExp(' ?filled ?');
	for (var i = 0; i < customizationFields.length; i++)
		/* If the field is required and empty then we abort */
		if (parseInt(customizationFields[i][1]) == 1 && $('#' + customizationFields[i][0]).val() == '' && !pattern.test($('#' + customizationFields[i][0]).attr('class')))
			return false;
	return true;
}

