var
	monthNames 				= new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"),
	weekdayNames			= new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");



	//	Open new window at right side of screen

	function openNewWindow(url, name, width, height, bRandomPosition) {
		try {
			if (typeof(name) == 'undefined') {
				name = url.replace(/\.html$/i, "");
			}
		
			name = name.replace(/[\/\-]/g, "");

			
			if (typeof(width) == 'undefined') {
				width = 380;

			} else if (width > window.screen.availWidth) {
				width = window.screen.availWidth;
			}
		
			
			
			if (typeof(height) == 'undefined') {
				height = 545;
			
			} else if (height > window.screen.availHeight) {
				height = window.screen.availHeight;
			}

			
			var
				wnd = window.open(url, 'newwindow_' + name, 'scrollbars=yes,width=' + width + ',height=' + height + (bRandomPosition == true ? '' : ',top=10,left=' + (window.screen.availWidth - width - 20)));

			wnd.focus();
			return false;
	
		} catch (e) {
			return true;
		}
	}
	
	
	
	//	Check e-mail address validity
	
	function CheckEmail(email) {
		if (email.search(/^[a-z0-9\'\-_]+[a-z\'0-9\-_.]*@[a-z0-9\-_]+[a-z0-9\-_.]*\.[a-z]{2,4}$/i) == -1) {
			return false;
		}

		return true;
	}
	
	
	//	Check phone number validity
	
	function CheckPhoneNumber(phoneNumber) {
		if (phoneNumber.search(/^\+?[\d\(\)\s\-]+$/) == -1) {
			return false;
		}
		
		return true;
	}
	


	function rtrim(str) {
		return str.replace(/\s+$/g,"");
	}

	function ltrim(str) {
		return str.replace(/^\s+/g, "");
	}

	function trim(str) {
		str += '';
		return str.replace(/\s+$|^\s+/g, "");
	}

	function externalLinkOpen(objLink) {
		try {
			window.open(objLink.getAttribute('newhRef'), "newexternawindow", "toolbar=1,location=1,status=1,scrollbars=1,resizable=1");
			return false;
		} catch (ee) {
			return true;
		}
	}


//	Flash detected

var
	requiredVersion					= 5, // Version the user needs to view site (max 7, min 2)
	
	flash2Installed					= false,
	flash3Installed					= false,
	flash4Installed					= false,
	flash5Installed					= false,
	flash6Installed					= false,
	flash7Installed					= false,
	
	maxVersion						= 7,
	actualVersion					= 0,
	
	isIE		= (navigator.appVersion.indexOf("MSIE") != -1)		? true : false,
	isWin		= (navigator.appVersion.indexOf("Windows") != -1)	? true : false,
	
	bFlashPresent					= false;
			
	if(isIE && isWin){
		document.write('<SCR' + 'IPT language="VBScript"\> \n');
		document.write('on error resume next \n');
		document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
		document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
		document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
		document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');
		document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');
		document.write('flash7Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');
		document.write('</SCR' + 'IPT\> \n');
	}
	
	function detectFlash() {  
		if (navigator.plugins) {
			if (
				navigator.plugins["Shockwave Flash 2.0"]
				||
				navigator.plugins["Shockwave Flash"]
			) {
				var
					isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "",
					flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description,
					flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
				
				// DEBUGGING: uncomment next line to see the actual description.
				//alert("Flash plugin description: " + flashDescription);
				
				flash2Installed = flashVersion == 2;
				flash3Installed = flashVersion == 3;
				flash4Installed = flashVersion == 4;
				flash5Installed = flashVersion == 5;
				flash6Installed = flashVersion == 6;
				flash7Installed = flashVersion >= 7;
			}
		}
		
		for (var i = 2; i <= maxVersion; i++) {	
			if (eval("flash" + i + "Installed") == true) actualVersion = i;
		}
		
		if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 2;	
		
		//	uncomment next line to display flash version during testing
		//alert("version detected: " + actualVersion);
		
		if (actualVersion >= requiredVersion) {
			bFlashPresent = true;
		}
	}


	detectFlash();


	function WordsBreak(text, width)
	{
		text = text.replace(/\s+/ig," ");
		text = text.replace(/^\s+|\s+$/ig,"");
	
		var words = text.split(" ");
		
		for (i=0; i < words.length;i++)
		{
			if (words[i].length > width)
			{
				words[i] = words[i].replace('/(^|[^&])([^&;]{2})([^&;]{2})([^;]|$)/', '\\1\\2' + '&shy;' + '\\3\\4');
			}
		}

		return words.join(' ');
	}



var
	IE = document.all,
	IE7 = navigator.appVersion.match(/MSIE\s+7\./),
	IE8 = navigator.appVersion.match(/MSIE\s+8\./),
	IE9 = navigator.appVersion.match(/MSIE\s+9\./),
	iOS = false,
	browserTouch = false;

function getElement(id) 
{
	return document.getElementById(id);
}

function getHead() 
{
	return document.getElementsByTagName("head")[0];
}

function getBody() 
{
	return document.getElementsByTagName("body")[0];
}

function deleteElement(id) 
{
	getElement(id).parentNode.removeChild(getElement(id));
}

function setOnload(f) 
{
	var
		onloadPrevious = window.onload;

	if (typeof(window.onload) != "function") 
		window.onload = function() {
			f();
		};
	else 
		window.onload = function() {
			onloadPrevious();
			f();
		};
}

function searchCheck_Simple(searchStatus, searchField) 
{
	if (!searchField) 
		var searchField = "searchInput_Field";

	if (getElement(searchField)) 
	{
		var searchInput_Field = getElement(searchField).value;

		if (
			trim(searchInput_Field) != ""
			&&
			searchInput_Field.toLowerCase() != (searchStatus ? searchStatus.toLowerCase() : "search")
		) {

			return true;

		} else {

			alert("Please specify search string first and try again.");
			getElement(searchField).focus();
			return false;
		}
	}
}

function setCookie(name, value, expires, path, domain, secure) 
{
	document.cookie = name + "=" + escape(value) +
		((expires) ? "; expires=" + expires : "") +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		((secure) ? "; secure" : "");
}

function getCookie(name) 
{
	var
		cookie = " " + document.cookie,
		search = " " + name + "=",
		setStr = null,
		offset = 0,
		end = 0;

	if (cookie.length > 0) 
	{
		offset = cookie.indexOf(search);

		if (offset != -1) 
		{
			offset += search.length;
			end = cookie.indexOf(";", offset)

			if (end == -1) 
				end = cookie.length;

			setStr = unescape(cookie.substring(offset, end));
		}
	}

	return(setStr);
}

var sizeCorrection = function(element) {
	var widthDelta = element.width();
	element.css({"width" : element.outerWidth() + "px"});
	widthDelta = widthDelta - element.width();
	return widthDelta;
}

function getCoordinates(id) 
{
	var
		id = getElement(id),
		left = id.offsetLeft,
		top = id.offsetTop;
	
	for (var parent = id.offsetParent; parent; parent = parent.offsetParent) 
	{
		left += parent.offsetLeft - parent.scrollLeft;
		top += parent.offsetTop - parent.scrollTop;
	}

	return {
		width: id.offsetWidth,
		height: id.offsetHeight,
		left: left,
		top: top
	};
}


function addHandler(object, event, handler) 
{
	if (typeof object.addEventListener != "undefined") 
	{
		object.addEventListener(event, handler, false);

	} else if (typeof object.attachEvent != "undefined") {

		object.attachEvent("on" + event, handler);

	} else {

		throw "Incompatible browser";
	}
}

function removeHandler(object, event, handler) 
{
	if (typeof object.removeEventListener != "undefined") 
	{

		object.removeEventListener(event, handler, false);

	} else if (typeof object.detachEvent != "undefined") {

		object.detachEvent("on" + event, handler);

	} else {

		throw "Incompatible browser";
	}
}

function setAnchor() 
{
	if (getBody().getElementsByTagName("a").length) 
	{
		var anchorArray = getBody().getElementsByTagName("a");

		for (var i = 0; i < anchorArray.length; i++) 
		{
			if (
				anchorArray[i].getAttribute("name") != ""
				&& 
				anchorArray[i].getAttribute("name") != null
				&&
				(
					anchorArray[i].getAttribute("href") == "" 
					||
					anchorArray[i].getAttribute("href") == null
				)
			) {
				anchorArray[i].className = (anchorArray[i].className == "") ? "anchor" : (anchorArray[i].className + " anchor");
			}
		}
	}
}

function classOver(object, classAppend) 
{
	if (object) 
	{
		if (typeof(object) != "object" && getElement(object))
		{
			object = getElement(object);
		}
	
		var classAppend = classAppend || "over";
		var classPresent = new RegExp('(^|\\s+)' + classAppend + '(\\s+|$)', 'i');
		var currentClass = object.className + '';

		if (currentClass.match(classPresent))
		{
			object.className = currentClass.replace(classPresent, '$2');
		} else {
			object.className = currentClass + (currentClass ? ' ' : '') + classAppend;
		}
	}
}

function deleteClassFromChilds(object, classAppend)
{
	if (typeof(object) != "object" && getElement(object)) 
		object = getElement(object);

	var reg = new RegExp('(^|\\s+)' + classAppend + '(\\s+|$)', 'i');
	var childs = object.childNodes;

	for (var i = 0; i < childs.length; i++)
	{
		try 
		{
			var cl = childs[i].className + '';
			if (cl.match(reg))
			{
				childs[i].className = cl.replace(reg, '$2');
			}

			deleteClassFromChilds(childs[i], classAppend);
			
		} catch (e) {
		}
	}
}

function setFavorites() 
{
	document.all ? window.external.addFavorite(window.location.href, document.title) : alert('Press CTRL and D to add a bookmark to:\n' + document.title);
	return false;
}


function checkInt(el)
{
	var val = (el.value + '').replace(/^[^0-9]+|[^0-9]+$/g, '').replace(/^([0-9]+).*$/, '$1');
	if (el.value * 1 != val)
		el.value = val;
}


function checkMaxWords(el, count)
{
}


function parseJson(text)
{
	var res;

	try {
		res = eval('(' + text + ')');
	} catch(e) {
		res = false;
	}

	return res;
}

function getXmlHttpObject()
{
	if (window.XMLHttpRequest)
	{
		// code for IE7+, Firefox, Chrome, Opera, Safari
		try {
			return new XMLHttpRequest();

		} catch (e) {

			// code for IE6, IE5
			return new ActiveXObject("Microsoft.XMLHTTP");
		}

	} else {

		// code for IE6, IE5
		return new ActiveXObject("Microsoft.XMLHTTP");
	}

	return null;
}

function checkMaxlength(tag)
{
	if (tag.getAttribute("maxlength")) 
	{
		var maxlength = parseInt(tag.getAttribute("maxlength"));
		if (tag.value.length > maxlength) 
			tag.value = tag.value.substring(0, maxlength);
	}
}



function checkFormFields(form, fields, onCheck)
{
	var updateTimer = false, errorField = null, el, fieldsE = [], fieldsSwap = [], cbSwap = null, that = this;

	for (var i = 0, j = 0; i < fields.length; i++)
	{
		if (fields[i].match(/=/))
		{
			var items = fields[i].split('=');
			fieldsE[j] = [];
			for (var k = 0, count = items.length; k < count; k++)
			{
				fieldsE[j].push($('#' + items[k]));
			}	
			j++;

			items.splice(0,0,i,1);
			fields.splice.apply(fields, items);
		}
	}
	
	for (var i in fields)
	{
		fieldset = fields[i].split('|');

		for(var j in fieldset)
		{
			if (el = $('#' + fieldset[j]))
			{
				el.bind({ keyup: function(){that.onChange()}, change: function(){that.onChange()}, click: function(){that.onChange()} });
				!getElement('img_' + (el.is('input[type=checkbox]') || el.is('input[type=radio]') ? el.attr('name') : fieldset[j])) && el.after('<img src="/images/common/required-star.png" alt="*" class="asterisk" id="img_' + fieldset[j] + '" />');
			}

		}
	}

	this.checkFields = function() 
	{
		onCheck && onCheck();

		var el, img, result = true, fieldset, fieldsetComplete;
    	
		updateTimer && (window.clearTimeout(updateTimer), updateTimer = false);
    	
		errorField = null;
    	
		for (var i = 0, count = fields.length; i < count; i++)
		{
			fieldset = fields[i].split('|');

			fieldsetComplete = false;
			for (var j = 0; j < fieldset.length; j++)
			{
				if (el = $('#' + fieldset[j]))	
				{
					if (
						((el.is('input[type=checkbox]') || el.is('input[type=radio]')) ? el.prop('checked') : (el.val() != '' && el.val() != null)) 
						&& 
						(!el.attr('minlength') || el.attr('minlength') <= el.val().length))
					{
						fieldsetComplete = true;
						break;
                    }
				}
			}

			for (var j = 0; j < fieldset.length; j++)
			{
			    if (img = $('#img_' + (el.is('input[type=checkbox]') || el.is('input[type=radio]') ? el.attr('name') : fieldset[j]))) 
                {
                    if (!fieldsetComplete)
                    {
    					result = false;
    					img.css('visibility', 'visible');
    					errorField = errorField || el;
                    
                    }else{
    					img.css('visibility', 'hidden');
                    } 
				}
			}
		}
    	
		return result;
	}
	
	this.onChange = function ()
	{
		updateTimer && window.clearTimeout(updateTimer);
		updateTimer = window.setTimeout( function() { that.checkFields() }, 500);
	}
		
	$('#' + form).bind('submit',  function() 
	{
 		var error = false;
	
 		if (!that.checkFields())
		{
			errorField && errorField.focus();
			alert("Please fill all required fields.");
			return false;
		}
	
		$('#' + form).find('.typeEmail').each(function() {
			if (this.value != '' && !CheckEmail(this.value))
			{
				alert("Please enter correct email address.");
				this.focus();
				error = true;
				return false;
			}
		});

		if (error) return false;
		
		$('#' + form).find('.typePhone').each(function() {

			if (this.value != '')
			{
				var phone = (this.value + '').replace(/\s+/g, " ").replace(/(\s+$|^\s+)/, "");
				this.value != phone && (this.value = phone);
			
				if (phone && !CheckPhoneNumber(phone)) 
				{
					alert("Please enter correct phone number.");
					this.focus();
					error = true;
					return false;
				}
			}
		});

		if (error) return false;
		
		if (fieldsE.length > 0) 
		{
			for(var i = 0; i < fieldsE.length; i++)
			{
				var prevValue;
				var bEqual = true;
				if (fieldsE[i].length > 1) 
				{
					prevValue = fieldsE[i][0].val();
					for(var j = 1; j < fieldsE[i].length; j++)
					{
						bEqual = bEqual && (prevValue == fieldsE[i][j].val());
						if(!bEqual)
						{
							alert("Entered values did not match. Please fill again.");
							fieldsE[i][j].val('');
							fieldsE[i][j].focus();
							error = true;
							return false;
						}
					}
				}
			}
		}

		if (fieldsSwap.length > 0 && (fieldsSwap[0][1].prop('disabled'))) 
		{
			for(var i = 0; i < fieldsSwap.length; i++)
			{
				fieldsSwap[i][1].prop('disabled', false);
			}

		}
	});
	    
	this.swap = function() 
	{
		for(var i = 0; i < fieldsSwap.length; i++)
		{
			if (fieldsSwap[i].length > 1 && fieldsSwap[i][1].prop('disabled') != cbSwap.prop('checked')) 
			{
				fieldsSwap[i][1].prop('disabled', cbSwap.prop('checked'));
			}
			
			if (cbSwap.prop('checked') && (fieldsSwap[i][1].val() != fieldsSwap[i][0].val()))
			{
				fieldsSwap[i][1].val(fieldsSwap[i][0].val());
			}

			this.checkFields();
		}
	}

	this.checkSameFields = function(el, fields)
	{
		cbSwap = $('#' + el);

		for (var i = 0, j = 0; i < fields.length; i++)
		{
			if (fields[i].match(/=/))
			{
				var items = fields[i].split('=');
				fieldsSwap[j] = [];
				for (var k = 0, count = items.length; k < count; k++)
				{
					fieldsSwap[j].push($('#' + items[k]));
				}	
				j++;
			}
		
		}   	

		window.setInterval(function() { that.swap() }, 500);
	}

	this.onChange();
}

function round(val, precision, mode) 
{
    // *     example 1: round(1241757, -3);
    // *     returns 1: 1242000
   	// *     example 2: round(3.6);
    // *     returns 2: 4
   	// *     example 3: round(2.835, 2);
    // *     returns 3: 2.84
   	// *     example 4: round(1.1749999999999, 2);
    // *     returns 4: 1.17
   	// *     example 5: round(1.17499999999999, 2);
    // *     returns 5: 1.18

	var retVal = 0, v = '', integer = '', decimal = '', decp = 0, negative = false;
	var _round_half_oe = function (dtR, dtLa, even) 
	{
		// round to odd or even
		if (even === true) 
		{
			if (dtLa === 50) 
			{
				if ((dtR % 2) === 1) 
					dtR += dtLa >= 5 ? 1 : -1;

			} else if (dtLa >= 5) {
				dtR++;
			}

		} else {

			if (dtLa === 5) 
			{
				if ((dtR % 2) === 0) 
					dtR += dtLa >= 5 ? 1 : -1;

            } else if (dtLa >= 5) {
   	            dtR++;
       	    }
        }

		return dtR;
	};

	var _round_half_ud = function (dtR, dtLa, up) 
	{ 
		// round up or down
		dtR += (dtLa > 5) || (up === true && dtLa == 5) ? 1 : 0;
        return dtR;
   	};

   	var _round_half = function (val, decplaces, mode) 
	{
       	var v = val.toString(), vlen = 0, vlenDif = 0;
        var decp = v.indexOf('.');
		if (decp == -1)
		{
			v += '.';
			for(var i=0; i<decplaces; i++)
			{
				v += '0';
			}
		}
		decp = v.indexOf('.');
   	    var digitToRound = 0, digitToLookAt = 0;
       	var integer = '', decimal = '';
        var round = null, bool = false;

        switch (mode) 
		{
       	    case 'up':
           	    bool = true;
               	// Fall-through
            case 'down':
   	            round = _round_half_ud;
       	        break;
            case 'even':
   	            bool = true;
       	        // Fall-through
            case 'odd':
   	            round = _round_half_oe;
       	        break;
        }

           if (decplaces < 0) 
		{ 
			// Int round
       	    vlen = v.length;
           
               decplaces = vlen + decplaces;
       	    digitToLookAt = Number(v.charAt(decplaces));
               digitToRound  = Number(v.charAt(decplaces - 1));
       	    digitToRound  = round(digitToRound, digitToLookAt, bool);
       	    v = v.slice(0, decplaces - 1);
               vlenDif = vlen - v.length - 1;
           
               if (digitToRound === 10) {
       	        v = String(Number(v) + 1) + '0';
               } else {
                   v += digitToRound;
       	    }
           
               v = Number(v) * (Math.pow(10, vlenDif));

       	} else if (decplaces > 0) {

               integer = v.slice(0, decp);
               decimal = v.slice(decp + 1);
       	    digitToLookAt = Number(decimal.charAt(decplaces));
      
           	digitToRound  = Number(decimal.charAt(decplaces - 1));
            digitToRound  = round(digitToRound, digitToLookAt, bool);
   	        decimal = decimal.slice(0, decplaces - 1);
       	    if (digitToRound === 10) 
			{
           	    v = Number(integer + '.' + decimal) + (1 * (Math.pow(10, (0 - decimal.length))));
            } else {
   	            v = Number(integer + '.' + decimal + digitToRound);
       	    }

        } else { // 0 decimal places

   	        integer = v.slice(0, decp);
       	    decimal = v.slice(decp + 1);
           	digitToLookAt = Number(decimal.charAt(decplaces));
            digitToRound = Number(integer.charAt(integer.length - 1));
   	        digitToRound = round(digitToRound, digitToLookAt, bool);
       	    decimal = '0';
           	integer = integer.slice(0, integer.length - 1);
            if (digitToRound === 10) {
   	            v = Number((Number(integer) + 1) + decimal); // Need to add extra 0 since passing 10
       	    } else {
           	    v = Number(integer + digitToRound);
            }
   	    }

       	return v;
    };

    // precision optional - defaults 0
   	if (typeof precision === 'undefined') 
        precision = 0;
   
   	// mode optional - defaults round half up
    if (typeof mode === 'undefined') 
		mode = 'PHP_ROUND_HALF_UP';

   	negative = val < 0; // Remember if val is negative

  		v = Math.abs(val).toString(); // Take a string representation of val
  		decp = v.indexOf('.');        // And locate the decimal point

   	if (decp === -1 && precision >= 0) 
	{
        return val;

   	} else {

       	if (decp === -1) 
		{
            // There are no decimals so integer=V and decimal=0
   	        integer = v;
       	    decimal = '0';

        } else {

            // Otherwise we have to split the decimals from the integer
   	        integer = v.slice(0, decp);
       	    if (precision >= 0) 
			{
           	    // If the precision is greater than 0 then split the decimals from the integer
               	// We truncate the decimals to a number of places equal to the precision requested+1
               	decimal = v.substr(decp + 1, precision + 1);
            } else {
   	            // If the precision is less than 0 ignore the decimals - set to 0
       	        decimal = '0';
           	}
       	}

        if (precision > 0 && precision >= decimal.length) 
		{
            /*
   	        * If the precision requested is more decimal places than already exist
       	    * there is no need to round - return val
           	*/
            return val;
   	    } else if (precision < 0 && Math.abs(precision) >= integer.length){
       	   /*
           	* If the precison is less than 0, and is greater than than the
            * number of digits in integer, return 0 - mimics PHP
   	        */
       	    return 0;
        }

        if (decimal === '0') 
   	        return Number(integer);
       
       	val = Number(integer + '.' + decimal); // After sanitizing, recreate val
    }

    // Call approriate function based on passed mode, fall through for integer constants
   	switch (mode) 
	{
       	case 0: case 'PHP_ROUND_HALF_UP':
           	retVal = _round_half(val, precision, 'up');
            break;
   	    case 1:  case 'PHP_ROUND_HALF_DOWN':
       	    retVal = _round_half(val, precision, 'down');
           	break;
        case 2: case 'PHP_ROUND_HALF_EVEN':
   	        retVal = _round_half(val, precision, 'even');
       	    break;
        case 3: case 'PHP_ROUND_HALF_ODD':
   	        retVal = _round_half(val, precision, 'odd');
       	    break;
    }

   	return negative ? 0 - retVal : retVal;
}

try {
	Number.prototype._toFixed = Number.prototype.toFixed;
	Number.prototype.toFixed = function (n){return round(this,n)._toFixed(n);};
} catch (e) {
}


	// Returns a positive value if a > b, zero if a = b and a negative value if a < b
	// $p - precision (default value 0.01 - for money comparision)
	function fcmp(a, b, p)
	{
		return Math.abs(a - b) < (typeof p == 'undefined' ? 0.01 : p) ? 0 : (a > b ? 1 : -1);
	}

	function WordsBreak(text, width)
	{
		text = text.replace(/\s+/ig," ");
		text = text.replace(/^\s+|\s+$/ig,"");
	

		var words = text.split(" ");
		var EngA = "[qwertyuiopasdfghjklzxcbvnm]";
		var EngV = "[eyuioa]";
		var EngN = "[qwrtpsdfghjklzxcvbnm]";
		var Hyphen = "\xAD";

		var re1 = new RegExp("("+EngA+EngV+")("+EngV+EngA+")","ig");
		var re2 = new RegExp("("+EngV+EngN+")("+EngN+EngV+")","ig");
		var re3 = new RegExp("("+EngN+EngV+")("+EngN+EngV+")","ig");
		var re4 = new RegExp("("+EngV+EngN+")("+EngN+EngN+EngV+")","ig");
		var re5 = new RegExp("("+EngV+EngN+EngN+")("+EngN+EngN+EngV+")","ig");
		var re6 = new RegExp("([0-9][0-9][0-9])([0-9][0-9][0-9])","ig");
		var re7 = new RegExp("([a-z][a-z][a-z])([a-z][a-z][a-z])","ig");
		var re8 = new RegExp("([a-z][a-z][a-z])([a-z][a-z])","ig");

		for (i=0; i < words.length;i++)
		{
			if (words[i].length > width)
			{
				words[i] = words[i].replace(re1, "$1"+Hyphen+"$2");
				words[i] = words[i].replace(re2, "$1"+Hyphen+"$2");
				words[i] = words[i].replace(re3, "$1"+Hyphen+"$2");
				words[i] = words[i].replace(re4, "$1"+Hyphen+"$2");	
				words[i] = words[i].replace(re5, "$1"+Hyphen+"$2");
				words[i] = words[i].replace(re6, "$1"+Hyphen+"$2");
				words[i] = words[i].replace(re7, "$1"+Hyphen+"$2");
				words[i] = words[i].replace(re8, "$1"+Hyphen+"$2");
			}

		}
		return words.join(' ');
	}


	function html2text(src, stripTags)
	{
		var el = document.createElement('TEXTAREA'), res = '';

		res = (typeof src == 'object' ? src : getElement(src)).innerHTML;
		el.innerHTML = stripTags ? (res+'').replace(/<.+?>/g, '') : res;

		return el.value;
	}

