/*! Table of Contents
//4. setImageHover
//3. changeLocation
//2. fixHeight
//1. globalGetDivFullSize
*/

//var globalRootDirectory ="new/";
var globalRootDirectory ="";
var globalDirectories ={'views':'views/', 'layouts':'layouts/', 'css':'css/', 'js':'js/', 'images':'images/'};
var globalDivIds ={'leftDiv':'leftDiv', 'rightDiv':'rightDiv'};
var globalMinHeight =620;

/*!
sets the top right perfume links (to individual perfume pages)
'name' =displayed text
'link' =the link to go to when the user clicks on it (minus the ".php" will will automatically be appended to the end)
*/
var globalPerfumeLinks =new Array(
{'name':'eros', 'link':'eros'},
{'name':'ondine', 'link':'ondine'},
//{'name':'voile', 'link':'voile'},
{'name':'drifting sparks', 'link':'drifting_sparks'},
{'name':'yuzu citrus', 'link':'yuzu_citrus'},
{'name':'havana', 'link':'havana'},
//{'name':'sweet earth', 'link':'sweet_earth'},
{'name':'belle starr', 'link':'belle_starr'},
//{'name':'after rain', 'link':'after_rain'},
{'name':'orchard', 'link':'orchard'},
{'name':'rayon vert', 'link':'rayon_vert'}
);

/*!
sets the links under the fragrance links (the main pages) - 2D associative array where each one represents one link with the following values:
'name' =string of what is displayed on the site
'link' =the link to go to when the user clicks on it (minus the ".php" will will automatically be appended to the end)
'indexHoverImg" =string of the image to be used on opening page when the user mouses over it
*/
var globalMainMenuLinks =new Array(
{'name':'about', 'link':'about', 'indexHoverImg':'about-text-hover.png'},
{'name':'press', 'link':'press', 'indexHoverImg':'about-text-hover.png'},
{'name':'eau de parfums', 'link':'fragrance', 'indexHoverImg':'about-text-hover.png'},
{'name':'contact', 'link':'contact', 'indexHoverImg':'about-text-hover.png'}
);

/*!
2D array of information to build an individual fragrance page:
'name' =string of name to be used at the top (also referred to as "title" below)
'bgImg' =the image file name in the images directory to be used as the background image on the left
'topTitleLeft' =integer of number of pixels to offset the title to the left
'topTitleColor' =the color of the text for the title/name
'perfumeBottleLeft' =integer of pixels for where the perfume bottle icon is displayed (negative values move it off the page to hide it since some background images include the perfume bottle)
'fragranceIcon' =image file for the icon in the top right
'fragranceDescription' =text for description on the left side
'fragranceDescriptionColor' =color of text on left
'payPalButtonId' =id of pay pal button for this specific perfume
'descHtml' =text for right column description
*/
var globalFragrancePage ={
'after_rain':{'name':'after rain', 'bgImg':'after_rain_bg.jpg', 'topTitleLeft':210, 'topTitleColor':'#DF4692', 'perfumeBottleLeft':-1000, 'payPalButtonId':'9946555', 'descHtml':'Base notes of gentle white lavender; sweet herbal notes of clary sage, with a garden that includes rose damask and rose geranium, the magic of ambergris and a jolt of red myrtle. Beautifully complex.'},

'belle_starr':{'name':'belle starr', 'bgImg':'belle_starr_bg.jpg', 'topTitleLeft':270, 'topTitleColor':'white', 'perfumeBottleLeft':220, 'fragranceIcon':'belle-starr-icon-big.png', 'fragranceDescription':'Belle Starr', 'fragranceDescriptionColor':'orange', 'payPalButtonId':'Z8VPRPU7XN5J8', 'descHtml':'Exotic essences of karo-karounde flowers and rooibos tea leaves from Africa join with sexy jasmine, cepes, and tonka bean to form a sweet, yet torrid homage to the outlaw, Belle Starr.'},

'drifting_sparks':{'name':'drifting sparks', 'bgImg':'drifting_sparks_bg.jpg', 'topTitleLeft':180, 'topTitleColor':'#DF4692', 'perfumeBottleLeft':390, 'fragranceIcon':'drifting-sparks-icon-big.png', 'fragranceDescription':'Musk has been used for millenium to excite sexuality. Fifteen traditional plants with musk qualities create basenotes that unconsciously evoke pleasure.', 'fragranceDescriptionColor':'rgb(30,30,30)', 'payPalButtonId':'8HS4AJTDFYP5L', 'descHtml':'sensual musk, with notes of orange blossoms, turkish rose, harshingar, and gentle jasmine. complex base of ambergris, oud, black current, and angelica root creates a warm rich musk. The true fragrance of pleasure.'},

'eros':{'name':'eros', 'bgImg':'eros_bg.jpg', 'topTitleLeft':210, 'topTitleColor':'white', 'perfumeBottleLeft':-1000, 'payPalButtonId':'KAUP7T9N6NNSG', 'descHtml':'Dark Bourbon Rose is the middle note, on the threshold of muskiness; combined with vetiver and oak moss, redolent with earthy scents and the siren call of rare, violet-like orris root, Eros touches all the pleasure centers.'},

'havana':{'name':'havana', 'bgImg':'havana_bg.jpg', 'topTitleLeft':210, 'topTitleColor':'white', 'perfumeBottleLeft':-1000, 'payPalButtonId':'5F7G7KSDFPFC2', 'descHtml':'Blossoms of the coffee flower mingle with cognac, antique clove, and blood orange. Hints of Himalayan cedarwood in a cascade of evocative smells.'},

'ondine':{'name':'ondine', 'bgImg':'ondine_bg.jpg', 'topTitleLeft':260, 'topTitleColor':'#DF4692', 'perfumeBottleLeft':-1000, 'payPalButtonId':'45Z64W9KYPKHE', 'descHtml':'Essences of narcissus and myrrh and sweet kewda attar relax the senses and unlock memories of river, lake and pond.'},

'orchard':{'name':'orchard', 'bgImg':'orchard_bg.jpg', 'topTitleLeft':270, 'topTitleColor':'#DF4692', 'perfumeBottleLeft':390, 'fragranceIcon':'orchard-icon-big.png', 'fragranceDescription':'Orchard', 'fragranceDescriptionColor':'white', 'fragranceDescriptionPaddingTop':150, 'payPalButtonId':'CBSBJ7L2NLYU4', 'descHtml':'Mimosa, wild chamomile, and night-blooming jasmine hover as blossoms over leafy, earthy notes of vetiver and oak moss. Orchard is a full essence for both men and women'},

'rayon_vert':{'name':'rayon vert', 'bgImg':'rayon_vert_bg.jpg', 'topTitleLeft':260, 'topTitleColor':'white', 'perfumeBottleLeft':-1000, 'payPalButtonId':'FBJZN9WU7Q7D4', 'descHtml':'Intricate mosaic of scents, evoking dark licorice and roots, moss and herbs, wet forest and rain-soaked meadows. Lush pink frangipani and a special blend of anise-hyssop, all in a swirl of emerald green.'},

'sweet_earth':{'name':'sweet earth', 'bgImg':'sweet_earth_bg.jpg', 'topTitleLeft':210, 'topTitleColor':'white', 'perfumeBottleLeft':-1000, 'payPalButtonId':'9946577', 'descHtml':'Bright green notes of linden blossom, wintergreen and celery seed morph into dreamy lush tuberose, ginger lily, and rich vanilla-scented tonka bean.'},

'voile':{'name':'voile', 'bgImg':'voile_bg.jpg', 'topTitleLeft':210, 'topTitleColor':'white', 'perfumeBottleLeft':-1000, 'payPalButtonId':'9946525', 'descHtml':'Essences of narcissus and myrrh and sweet kewda attar relax the senses and unlock memories of river, lake and pond.'},

'yuzu_citrus':{'name':'yuzu citrus', 'bgImg':'yuzu_citrus_bg.jpg', 'topTitleLeft':160, 'topTitleColor':'white', 'perfumeBottleLeft':-1000, 'payPalButtonId':'A83HHGDQM7UAN', 'descHtml':'Citrusy, lemon verbena notes in harmony with exotic Indian harshingar and galbanum with a hint of honey absolute.'},
};

//4.
/*!
@param imgId =string of id
@param imgClass =string of class
@param imgLinkPart =img link src part (globalDirectories['images'] will be prepended)
@param imgLinkHoverPart =img link src part (globalDirectories['images'] will be prepended)
@param params
*/
function setImageHover(imgId, imgClass, imgLinkPart, imgLinkPartHover, params)
{
	if(imgId && imgId.length >0)
	{
		var imgEle ="#"+imgId;
	}
	else if(imgClass && imgClass.length >0)
	{
		var imgEle ="."+imgClass;
	}
	$(imgEle).hover(
		function()
		{
			$(imgEle).attr('src',globalDirectories['images']+imgLinkPartHover);
		},
		function()
		{
			$(imgEle).attr('src',globalDirectories['images']+imgLinkPart);
		}
	);
}

//3.
/*!
@param linkUrl
*/
function changeLocation(linkUrl)
{
	//if(linkUrl.indexOf("http://") <0)
	//	linkUrl =globalRootDirectory+linkUrl;
	window.location =linkUrl;
}


//2.
/*!
makes left & right div at least the minimum height and makes them both the same height
@param minHeightSet
*/
function fixHeight(minHeightSet)
{	
	var leftHeightVals =globalGetDivFullSize(globalDivIds['leftDiv'], 'height');		//function
	var rightHeightVals =globalGetDivFullSize(globalDivIds['rightDiv'], 'height');		//function
	var biggerDiv ="left";
	var maxHeight =leftHeightVals['totalHeight'];
	if(rightHeightVals['totalHeight'] >maxHeight)
	{
		maxHeight =rightHeightVals['totalHeight'];
		biggerDiv ="right";
	}
	if(maxHeight <minHeightSet)
	{
		$("#"+globalDivIds['leftDiv']).height(minHeightSet -leftHeightVals['paddingMarginHeight'] -leftHeightVals['borderHeight']);
		$("#"+globalDivIds['rightDiv']).height(minHeightSet -rightHeightVals['paddingMarginHeight'] -rightHeightVals['borderHeight']);
	}
	else
	{
		if(biggerDiv =="right")
			$("#"+globalDivIds['leftDiv']).height(rightHeightVals['totalHeight'] -leftHeightVals['paddingMarginHeight']);
		else if(biggerDiv =="left")
			$("#"+globalDivIds['rightDiv']).height(leftHeightVals['totalHeight'] -rightHeightVals['paddingMarginHeight']);
	}
	//alert("yes");
}

//1.
/*!
@param divId
@param typeTrigger = "height" or "width" or "both"
@return associative array of:
	"totalHeight"
	"paddingMarginHeight"
	"paddingHeight"
	"marginHeight"
	"borderHeight"
	"totalWidth"
	"paddingMarginWidth"
	"paddingWidth"
	"marginWidth"
	"borderWidth"
*/
function globalGetDivFullSize(divId, typeTrigger)
{
	var eleTemp =$("#"+divId);
	if(typeTrigger =="height" || typeTrigger =="both")
	{
		var paddingMarginHeight =eleTemp.css('marginTop').replace('px', '')*1 +eleTemp.css('marginBottom').replace('px', '')*1 +eleTemp.css('paddingBottom').replace('px', '')*1 +eleTemp.css('paddingTop').replace('px', '')*1
		var paddingHeight =eleTemp.css('paddingBottom').replace('px', '')*1 +eleTemp.css('paddingTop').replace('px', '')*1;
		var marginHeight =eleTemp.css('marginTop').replace('px', '')*1 +eleTemp.css('marginBottom').replace('px', '')*1;
		//var heightTemp =eleTemp.height() +paddingMarginHeight +borderHeight;
		//var borderHeight =eleTemp[0].style.borderTop +eleTemp[0].style.borderBottom;		//doesn't work... apparently no easy way to get border - just use outer (total) height then subtract padding & margin to get border... ASSUMING border is the only remaining difference
		var heightTemp =eleTemp.outerHeight();
		var borderHeight =heightTemp -eleTemp.height() -paddingMarginHeight;
		if(typeTrigger =="height")
			return {"totalHeight":heightTemp, "paddingMarginHeight":paddingMarginHeight, 'paddingHeight':paddingHeight, 'marginHeight':marginHeight, 'borderHeight':borderHeight};
	}
	if(typeTrigger =="width" || typeTrigger =="both")
	{
		var paddingMarginWidth =eleTemp.css('marginLeft').replace('px', '')*1 +eleTemp.css('marginRight').replace('px', '')*1 +eleTemp.css('paddingLeft').replace('px', '')*1 +eleTemp.css('paddingRight').replace('px', '')*1
		var paddingWidth =eleTemp.css('paddingLeft').replace('px', '')*1 +eleTemp.css('paddingRight').replace('px', '')*1;
		var marginWidth =eleTemp.css('marginLeft').replace('px', '')*1 +eleTemp.css('marginRight').replace('px', '')*1;
		//var borderWidth =eleTemp.css('borderLeft').replace('px','')*1 +eleTemp.css('borderRight').replace('px', '')*1;		//doesn't work..
		var widthTemp =eleTemp.outerWidth();
		var borderWidth =widthTemp -eleTemp.width() -paddingMarginWidth;
		if(typeTrigger =="width")
			return {"totalWidth":widthTemp, "paddingMarginWidth":paddingMarginWidth, 'paddingWidth':paddingWidth, 'marginWidth':marginWidth, 'borderWidth':borderWidth};
	}
	return {"totalHeight":heightTemp, "paddingMarginHeight":paddingMarginHeight, 'paddingHeight':paddingHeight, 'marginHeight':marginHeight, "totalWidth":widthTemp, "paddingMarginWidth":paddingMarginWidth, 'paddingWidth':paddingWidth, 'marginWidth':marginWidth, 'borderHeight':borderHeight, 'borderWidth':borderWidth};
}
