try{
String.prototype.Contains=function(str){return this.indexOf(str)!=-1;}
String.prototype.ToCSSSafeName=function(){return this.replace(/[^_a-zA-Z0-9-]/g,'-');}
String.prototype.StartsWith=function(str){return this.match('^'+str)==str;}
String.prototype.EndsWith=function(str){return this.match(str+'$')==str;}
String.prototype.LTrim=function(chrs){chrs=chrs||' ';return this.replace(new RegExp('^['+chrs+']+','g'),'');}
String.prototype.RTrim=function(chrs){chrs=chrs||' ';return this.replace(new RegExp('['+chrs+']+$','g'),'');}
String.prototype.Trim=function(chrs){chrs=chrs||' ';return this.LTrim(chrs).RTrim(chrs);}
String.prototype.IsNumeric=function(){return this==parseInt(this);}
String.prototype.Repeat=function(num){return new Array(num+1).join(this);}
String.prototype.Pad=function(chr,length){var newStr=this;if(newStr.length<length){newStr=chr.Repeat(length-newStr.length)+newStr;}
return newStr;}
String.prototype.StripComments=function(Open,Close){var str=this;if(Open===undefined)Open='/*';if(Close===undefined)Close='/*';var commentStartPos=str.indexOf(Open);while(commentStartPos>=0){var commentEndPos=str.indexOf(Close,commentStartPos+2)+2;str=str.substr(0,commentStartPos)+str.substr(commentEndPos);if(commentStartPos+2<str.length)commentStartPos=str.indexOf(Open,commentStartPos+2);else commentStartPos=-1;}
return str;}
String.prototype.SubStrCount=function(needle,offset,length){var haystack=this;var pos=0;var count=0;haystack+='';needle+='';if(isNaN(offset)){offset=0;}
if(isNaN(length)){length=0;}
offset--;while((offset=haystack.indexOf(needle,offset+1))!=-1){if(length>0&&(offset+needle.length)>length)return false;else count++;}
return count;}
String.prototype.URLEncodeCharacter=function(){return'%'+this.charCodeAt(0).toString(16);}
String.prototype.URLDecodeCharacter=function(){return String.fromCharCode(parseInt(this,16));}
String.prototype.URLEncode=function(){return encodeURIComponent(this).replace(/\%20/g,'+').replace(/[!'()*~]/g,URLEncodeCharacter);}
String.prototype.URLDecode=function(){return decodeURIComponent(this.replace(/\+/g,'%20')).replace(/\%([0-9a-f]{2})/g,URLDecodeCharacter);}}catch(ex){if (typeof arguments != 'undefined') alert(arguments.callee.toString() + ': ' + ex.description);}try{
var hideShadeTimeout;function makeShade(shadeID){var shade=document.createElement('div');shade.setAttribute('id',shadeID+'Shd');shade.setAttribute('class','Shade');document.body.appendChild(shade);}
function showShade(shadeID,zIndex){if(typeof zIndex=='undefined')zIndex=false;if(!document.getElementById(shadeID+'Shd'))makeShade(shadeID);if(document.getElementById(shadeID+'Shd')){clearTimeout(hideShadeTimeout);if(zIndex)document.getElementById(shadeID+'Shd').style.zIndex=zIndex;document.getElementById(shadeID+'Shd').style.visibility='visible';document.getElementById(shadeID+'Shd').style.opacity='.35';}}
function hideShade(shadeID){if(!document.getElementById(shadeID+'Shd'))makeShade(shadeID);if(document.getElementById(shadeID+'Shd')){document.getElementById(shadeID+'Shd').style.opacity='0';clearTimeout(hideShadeTimeout);hideShadeTimeout=setTimeout(function(){document.getElementById(shadeID+'Shd').style.visibility='hidden';},400);}}
function sendDialogResponse(dialogWinName,responseMethodName,cancel){var responseArrayString='';var dialogWin=document.getElementById(dialogWinName);dialogWin.style.visibility='hidden';if(!cancel){for(var i=0;i<dialogWin.children.length;i++){var kid=dialogWin.children[i];if(kid.nodeName.toUpperCase()=='INPUT'||kid.nodeName.toUpperCase()=='TEXTAREA'){var id=kid.id;var value=kid.value;responseArrayString+=id+':"'+value+'",';}}}
dialogWin.style.opacity='0';var transformProperty=GetTransformProperty(dialogWin);if(cancel){if(transformProperty)dialogWin.style[transformProperty]='rotate(-15deg) scale(.2)';dialogWin.style.marginLeft='-450px';}
else{if(transformProperty)dialogWin.style[transformProperty]='rotate(16deg) scale(.2)';dialogWin.style.marginLeft='65px';}
setTimeout(function(){dialogWin.parentNode.removeChild(dialogWin);},700);if(typeof CurrentAppID!='undefined'){try{hideShade(CurrentAppID);}
catch(x){}}
if(!cancel){if(responseArrayString)responseArrayString='{'+responseArrayString.substring(0,responseArrayString.length-1)+'}';else responseArrayString=true;try{eval('try{'+responseMethodName+'('+responseArrayString+');}catch(x){}');}
catch(x){}}
else{try{eval('try{'+responseMethodName+'(false);}catch(x){}');}
catch(x){}}}
function ForceCloseDialog(ID,Animate,HideShade){if(typeof Animate=='undefined')Animate=true;if(typeof HideShade=='undefined')HideShade=true;var dialogWin=document.getElementById(ID);if(Animate){dialogWin.style.opacity='0';var transformProperty=GetTransformProperty(dialogWin);if(transformProperty)dialogWin.style[transformProperty]='rotate(-15deg) scale(.2)';dialogWin.style.marginLeft='-450px';dialogWin.style.mozBoxShadow='2px 0 5px Black';dialogWin.style.webkitBoxShadow='2px 0 5px Black';dialogWin.style.boxShadow='2px 0 5px Black';setTimeout(function(){dialogWin.parentNode.removeChild(dialogWin);},700);}
else dialogWin.parentNode.removeChild(dialogWin);if(HideShade)hideShade(CurrentAppID);}
function ShowDialog(HTML,ResponseMethodName,Width,Height,OK,ParentIDName,FocusID,Modal,OKDisabled,Top,Animate){var focusID=typeof FocusID!='undefined'?FocusID:'';if(typeof CurrentAppID=='undefined')CurrentAppID='';if(typeof UniqueResID=='undefined'){ShowDialog.UniqueResID=0;var dialogID='u'+ShowDialog.UniqueResID;}
else{UniqueResID++;var dialogID='u'+UniqueResID;}
if(typeof Top=='undefined')Top=110;if(typeof Animate=='undefined')Animate=true;try{if(Modal!=false)showShade(CurrentAppID);}
catch(x){CurrentAppID=null;ParentIDName=null;Modal=false;}
if(OKDisabled===true)OKDisabled='disabled=disabled';else OKDisabled='';if(OK===true)OK='OK';var buttonsHTML='<div id="btns">';var cancelText='Cancel';if(OK!=false)buttonsHTML+='<input id=\''+dialogID+'-k\' class="Button" type="button" value="'+OK+'" '+OKDisabled+' onclick="sendDialogResponse(\''+dialogID+'\', \''+ResponseMethodName+'\');">';else cancelText='Close';buttonsHTML+='<input id=\''+dialogID+'-c\' class="Button" type="button" value="'+cancelText+'" onclick="sendDialogResponse(\''+dialogID+'\', \''+ResponseMethodName+'\', true);"></div>';var idealLeft=Math.ceil(Width/2)-4;var dlg=document.createElement('div');dlg.setAttribute('id',dialogID);dlg.setAttribute('class','Dialog');dlg.setAttribute('style','width:'+(Width-20)+'px;height:'+(Height-20)+'px;left:50%;top:'+Top+'px;margin-left:-'+(idealLeft+140)+'px;');dlg.innerHTML=HTML+buttonsHTML;if(ParentIDName)document.getElementById(ParentIDName).appendChild(dlg);else{if(document.getElementById('p-'+CurrentAppID))document.getElementById('p-'+CurrentAppID).appendChild(dlg);else document.body.appendChild(dlg);}
if(Animate){setTimeout(function(){dlg.style.opacity='1';var transformProperty=GetTransformProperty(dlg);if(transformProperty)dlg.style[transformProperty]='rotate(0) scale(1)';dlg.style.marginLeft='-'+idealLeft+'px';},10);setTimeout(function(){dlg.style.mozBoxShadow='2px 6px 40px Black';dlg.style.webkitBoxShadow='2px 6px 40px Black';dlg.style.boxShadow='2px 6px 40px Black';},80);}
else{var transitionProperty=GetTransitionProperty(dlg);if(transitionProperty)dlg.style[transitionProperty]='none';dlg.style.opacity='1';var transformProperty=GetTransformProperty(dlg);if(transformProperty)dlg.style[transformProperty]='rotate(0) scale(1)';dlg.style.marginLeft='-'+idealLeft+'px';dlg.style.mozBoxShadow='2px 6px 40px Black';dlg.style.webkitBoxShadow='2px 6px 40px Black';dlg.style.boxShadow='2px 6px 40px Black';if(transitionProperty)dlg.style[transitionProperty]='all .2s ease-out';}
if(ParentIDName){var keyListener=function(e){var keyPressed=(e&&e.which)?e.which:event.keyCode;var ESC_KEY=27;var ENTER_KEY=13;if(keyPressed==ESC_KEY){document.getElementById(ParentIDName).RemoveEvent('onkeydown',keyListener,false);if(ResponseMethodName)sendDialogResponse(dialogID,ResponseMethodName,true);else ForceCloseDialog(dialogID);return false;}
else if(keyPressed==ENTER_KEY){document.getElementById(ParentIDName).RemoveEvent('onkeydown',keyListener,false);if(ResponseMethodName)sendDialogResponse(dialogID,ResponseMethodName);return false;}}
document.getElementById(ParentIDName).AddEvent('onkeydown',keyListener);}
if(focusID)setTimeout("document.getElementById('"+focusID+"').focus();",1);else{if(OK!=false)setTimeout("document.getElementById('"+dialogID+"-k').focus();",1);else setTimeout("document.getElementById('"+dialogID+"-c').focus();",1);}
return dialogID;}
var loaderDialogID=null;function SendWinHashChange(){if(window.location.hash=='#c'){setTimeout(function(){if(document.getElementById('GavaIFrame'))document.getElementById('GavaIFrame').parentNode.removeChild(document.getElementById('GavaIFrame'));},440);window.location.hash='';hideShade('');}}
function showContactIFrame(){document.getElementById('GavaIFrame').style.display='block';ForceCloseDialog(loaderDialogID,false,false);document.getElementById('GavaIFrame').focus();}
function Contact(){var width=680;var height=500;var idealLeft=Math.ceil(width/2);loaderDialogID=ShowDialog('<b style="color:#3E3E3E;font-family:\'lucida grande\',tahoma,verdana,arial,sans-serif;font-size:15px">Send Message</b><br><center style="cursor:wait;"><img src="https://gavamedia.com/w.gif" style="position:absolute;left:184px;top:130px;"><img src="https://gavamedia.com/gavalogin.jpg" style="opacity:.4;margin:15px 0 0;"></center>','',400,310,'Send',null,'',false,true,143);showShade('',1001);var loginSrc='https://gavamedia.com';if(window.location.hostname=='192.168.0.169')loginSrc='http://192.168.0.169';var dlg=document.createElement('iframe');dlg.setAttribute('id','GavaIFrame');dlg.setAttribute('style','text-align:left;display:none;border:none;width:'+width+'px;height:'+height+'px;left:50%;margin-left:-'+idealLeft+'px;position:fixed;top:110px;z-index:9000; ');dlg.onload=showContactIFrame;dlg.src=loginSrc+'/_a?r=sm&u='+encodeURI(document.URL);document.body.appendChild(dlg);if('onhashchange'in window)window.onhashchange=SendWinHashChange;else{window.onload=function(){setInterval(function(){if(CurentPageHash!=window.location.hash.substring(1))SendWinHashChange();},400);}}}}catch(ex){if (typeof arguments != 'undefined') alert(arguments.callee.toString() + ': ' + ex.description);}try{
if(XMLHttpRequest===undefined){XMLHttpRequest=function(){try{return new ActiveXObject('Msxml2.XMLHTTP.6.0');}catch(e){}
try{return new ActiveXObject('Msxml2.XMLHTTP.3.0');}catch(e){}
try{return new ActiveXObject('Msxml2.XMLHTTP');}catch(e){}
try{return new ActiveXObject('Microsoft.XMLHTTP');}catch(e){}
window.location='http://www.getfirefox.com/';};}
function loginRequiredResponseBackup(){location.reload(true);}
function Call(FunctionID,Parameters,ReturnFunction){var ajx=new XMLHttpRequest();var params='r='+FunctionID;if(Parameters)params+='&'+Parameters;params+='&u='+Math.random();ajx.open('POST','/_a',true);ajx.setRequestHeader('Content-type','application/x-www-form-urlencoded');ajx.setRequestHeader('Content-length',params.length);ajx.setRequestHeader('Connection','close');ajx.onreadystatechange=function(){if(ajx.readyState==4){if(ajx.status==401){if(typeof window.LoginRequired=='function')LoginRequired();else{ShowDialog('<h2>Login Required</h2><br>Please login to continue.','loginRequiredResponseBackup',330,145,false);}}
else if(ajx.status==403){ShowDialog('<h2>Access Denied</h2><br>You do not have permission to perform this action.',null,330,145,false);setTimeout(function(){ReturnFunction(ajx);},400);}
else ReturnFunction(ajx);}}
ajx.send(params);}}catch(ex){if (typeof arguments != 'undefined') alert(arguments.callee.toString() + ': ' + ex.description);}try{
var DocumentWidth=Math.max(document.body.offsetWidth,document.documentElement.clientWidth,document.documentElement.offsetWidth);var DocumentHeight=Math.max(document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.offsetHeight);window.onresize=function(e){setTimeout(function(){DocumentWidth=Math.max(document.body.offsetWidth,document.documentElement.clientWidth,document.documentElement.offsetWidth);DocumentHeight=Math.max(document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.offsetHeight);},10);}
function GetTransformProperty(element){var properties=['transform','WebkitTransform','MozTransform','msTransform','OTransform'];var p;while(p=properties.shift()){if(typeof element.style[p]!='undefined')return p;}
return false;}
function GetTransitionProperty(element){var properties=['transition','MozTransition','WebkitTransition','OTransition'];var p;while(p=properties.shift()){if(typeof element.style[p]!='undefined')return p;}
return false;}}catch(ex){if (typeof arguments != 'undefined') alert(arguments.callee.toString() + ': ' + ex.description);}try{
function removeZoomPic(e){var button=1;if(e.which)button=e.which;else button=event.button;if(button==1){var picBox=(e.srcElement)?e.srcElement:this;if(document.body.addEventListener)document.body.removeChild(document.getElementById('shadow'));document.body.removeChild(picBox);}}
function zoom(picURL){if(document.body.addEventListener){var shadow=document.createElement('div');shadow.id='shadow';document.body.appendChild(shadow);}
var newPic=document.createElement('img');newPic.id='pic';newPic.src=picURL;newPic.className='zoom';document.body.appendChild(newPic);setTimeout("document.getElementById('pic').style.zIndex = 999;",90);if(newPic.addEventListener)newPic.addEventListener('mousedown',removeZoomPic,false);else if(newPic.attachEvent)newPic.attachEvent('onmousedown',removeZoomPic);}
var _gaq=_gaq||[];_gaq.push(['_setAccount','UA-4801766-7']);_gaq.push(['_setDomainName','.cosmetco.com']);_gaq.push(['_trackPageview']);(function(){var ga=document.createElement('script');ga.type='text/javascript';ga.async=true;ga.src=('https:'==document.location.protocol?'https://ssl':'http://www')+'.google-analytics.com/ga.js';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(ga,s);})();}catch(ex){if (typeof arguments != 'undefined') alert(arguments.callee.toString() + ': ' + ex.description);}
