
/*################################
##			Forms				##
################################*/

var $formTextboxAutofillArray  = new Array(); 

function tbFill ($id , $action) {

	$textboxElement = document.getElementById($id);

	if ($action == 1) 
	{
		$textboxElement.style.border = '1px solid #FF6600';

		if ($formTextboxAutofillArray[$id])
		{
			if ($formTextboxAutofillArray[$id] == $textboxElement.value)
			{
				$textboxElement.value = "";
			}
			else 
			{
				return;
			}
		}
		else 
		{
			$formTextboxAutofillArray[$id] = $textboxElement.value;
			$textboxElement.value = "";
		}
	}
	else {

		if (($formTextboxAutofillArray[$id]) && $textboxElement.value == "") {
			$textboxElement.value = $formTextboxAutofillArray[$id];
			$textboxElement.style.border = '1px solid #E6E6E6';
		}
		else {
			$textboxElement.style.border = '1px solid #555555';
		}
	}

}

/*################################
##			DIVS				##
################################*/




function visualizer ($id , $action) { // Hide elements

	$divisionElement = document.getElementById($id);

	switch ($action)
	{
	case 0 :
		$divisionElement.style.visibility = "hidden";
		$divisionElement.style.display = "none";
		break;
	case 1 :
		$divisionElement.style.visibility = "visible";
		$divisionElement.style.display = "block";
		break;
	}

}

function editText ($id , $text) { // Edit innerHTML of element

	$coverElement = document.getElementById($id);
	$coverElement.innerHTML = $text;
}



/*################################
##			TAB CHANGER			##
################################*/

	$pagesIDs = new Array();
	$pagesIDs[0] = 'main-box1';
	$pagesIDs[1] = 'main-box2';
	$pagesIDs[2] = 'main-box3';

function changeToTab ($id) {

	var exist = false;

	for (x in $pagesIDs ) { // Check if tab exists
		if ( $pagesIDs[x] == $id) {
			exist = true;
		}
	}

	if (exist) {
		closeTabs();
		openTab($id);
	}

	return false;
}


function closeTabs () {
	for (x in $pagesIDs ) { // Close each tab
		visualizer ($pagesIDs[x] , 0);
	}
}

function openTab ($id) {
	visualizer ($id , 1);
}

/*################################
##			String Mods			##
################################*/

function stripCharacter(words,character) {
	  var spaces = words.length;
	  for(var x = 1; x<spaces; ++x){
	   words = words.replace(character, "");
	 }
	 return words;
}

/*################################
##			Cookies				##
################################*/

function setCookie(c_name,value,expires) {

	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );

	if ( expires )
	{
	expires = expires * 1000 * 60 //from milliseconds to minutes
	}
	var expires_date = new Date( today.getTime() + (expires) );

	document.cookie=c_name+ "=" +escape(value)+
	((expires==null) ? "" : ";expires="+expires_date.toGMTString());

}

function getCookie(c_name) {

	if (document.cookie.length>0) {
	  c_start=document.cookie.indexOf(c_name + "=");

	  if (c_start!=-1) { 
		c_start=c_start + c_name.length+1; 
		c_end=document.cookie.indexOf(";",c_start);

		if (c_end==-1) c_end=document.cookie.length;
		return unescape(document.cookie.substring(c_start,c_end));
		} 
	}
	return "";
}

function checkCookie(c_name){
	cookie=getCookie(c_name);
	if (cookie!=null && cookie!="") {
		return cookie;
	}
	else {
		return false;
	}
}


/*################################
##			IMAGE ROLLOVERS		##
################################*/

$preloadImages = new Array ();

function loadImages () {

	$imgs = new Array()

//	$imgID = 'productDemoen';
//	$imgs = [];
//	$imgs[0] = new Image(250,100) 
//	$imgs[0].src = "images/sidebanner1-en.jpg" 
//	$imgs[1] = new Image(250,100) 
//	$imgs[1].src = "images/sidebanner1-en-over.jpg" 
//	$preloadImages [$imgID] = $imgs;

}

function imgOver ( $id , $action ) { 
	$theImage = document.getElementById($id);
	$images = $preloadImages [$id];
	$theImage.src = $images[$action].src;
}


/*################################
##			ONLOAD				##
################################*/

// ONLOAD PAGE

function onloadScript () {
	loadImages ();
	//changeToTab ('main-box1');
}

window.onload = onloadScript();

