function doPopup(URL, WIDTH, HEIGHT) {
	url = URL;
	width = WIDTH;  // width of window in pixels
	height = HEIGHT; // height of window in pixels
	windowprops = "left=50,top=50,width=" + WIDTH + ",height=" + HEIGHT + "toolbar=no," + "location=no," + "directories=no," + "status=no," + "menubar=no," + "scrollbars=no," + "resizable=no,";
	preview = document.open(URL, "_blank", windowprops);
}

function textCounter(field, countfield, maxlimit) {
     if (field.value.length > maxlimit) { // if too long...trim it!
          field.value = field.value.substring(0, maxlimit);
     }

     // otherwise, update 'characters left' counter
     else
          countfield.value = maxlimit - field.value.length;
     }

function checkSmsLenght(string)
{
	if(document.SMS.SMSmessage.value == string)
		{ document.SMS.SMSmessage.value = ''; }
	else if (document.SMS.SMSmessage.value == '')
		{ document.SMS.SMSmessage.value = string; }
	else {

	}
}

var smsGateSwitcher = false;
var formOpacity = 0;
var pageType = 'hp';

// hide flash / show form
function switchSmsGateInAction(){
     if(formOpacity == 0) {
          document.getElementById('smsGate-form').style.display = 'block';
          document.getElementById('smsGate-form').style.opacity = 0.05;
          document.getElementById('sideFlash-'+pageType).style.display = 'none';
          document.getElementById('sideFlash-'+pageType+'-static').style.display = 'block';
          document.getElementById('sideFlash-'+pageType+'-static').style.opacity = 0.95;
          // for IE
          if(document.getElementById('sideFlash-'+pageType+'-static').filters){
               document.getElementById('smsGate-form').filters.item("Alpha").Opacity = 5;
               document.getElementById('sideFlash-'+pageType+'-static').filters.item("Alpha").Opacity = 65;
          }
          formOpacity = 0.05;
     }
     else if (formOpacity < 1) {
          document.getElementById('smsGate-form').style.opacity = eval(document.getElementById('smsGate-form').style.opacity) + 0.05;
          document.getElementById('sideFlash-'+pageType+'-static').style.opacity = eval(document.getElementById('sideFlash-'+pageType+'-static').style.opacity - 0.05);
          // for IE
          if(document.getElementById('sideFlash-'+pageType+'-static').filters){
               document.getElementById('smsGate-form').filters.item("Alpha").Opacity = eval(document.getElementById('smsGate-form').filters.item("Alpha").Opacity) + 5;
               document.getElementById('sideFlash-'+pageType+'-static').filters.item("Alpha").Opacity = eval(document.getElementById('sideFlash-'+pageType+'-static').filters.item("Alpha").Opacity) - 5;
          }
          formOpacity = formOpacity + 0.05;
     }
     else if (formOpacity >= 1) {
          document.getElementById('smsGate-flash').style.display = 'none';
          // for IE
          if(document.getElementById('sideFlash-'+pageType+'-static').filters){
               document.getElementById('smsGate-form').filters.item("Alpha").Enabled = false;
          }
          smsGateSwitcher = true;
     }
}

// show flash / hide form
function switchSmsGateOutAction(){
     if(formOpacity >= 1) {
          document.getElementById('smsGate-form').style.opacity = 0.95;
          document.getElementById('smsGate-flash').style.display = 'block';
          document.getElementById('sideFlash-'+pageType+'-static').style.opacity = 0.05;
          // for IE
          if(document.getElementById('sideFlash-'+pageType+'-static').filters){
               document.getElementById('smsGate-form').filters.item("Alpha").Enabled = true;
               document.getElementById('smsGate-form').filters.item("Alpha").Opacity = 95;
               document.getElementById('sideFlash-'+pageType+'-static').filters.item("Alpha").Opacity = 35;
          }
          formOpacity = 0.95;
     }
     else if (formOpacity > 0) {
          document.getElementById('smsGate-form').style.opacity = eval(document.getElementById('smsGate-form').style.opacity) - 0.05;
          document.getElementById('sideFlash-'+pageType+'-static').style.opacity = eval(document.getElementById('sideFlash-'+pageType+'-static').style.opacity) + 0.05;
          // for IE
          if(document.getElementById('sideFlash-'+pageType+'-static').filters){
               document.getElementById('smsGate-form').filters.item("Alpha").Opacity = eval(document.getElementById('smsGate-form').filters.item("Alpha").Opacity) - 5;
               document.getElementById('sideFlash-'+pageType+'-static').filters.item("Alpha").Opacity = eval(document.getElementById('sideFlash-'+pageType+'-static').filters.item("Alpha").Opacity) + 5;
          }
          formOpacity = formOpacity - 0.05;
     }
     else if (formOpacity <= 0) {
          document.getElementById('smsGate-form').style.display = 'none';
          document.getElementById('sideFlash-'+pageType).style.display = 'block';
          document.getElementById('sideFlash-'+pageType+'-static').style.display = 'none';
          // for IE
          if(document.getElementById('sideFlash-'+pageType+'-static').filters){
               document.getElementById('smsGate-form').filters.item("Alpha").Enabled = false;
          }
          smsGateSwitcher = false;
          formOpacity = 0;
     }
}

function switchSmsGateIn(){
     if(!smsGateSwitcher) {
          if(document.getElementById('smsGateFlashObject').name == 'branaSub'){
               pageType = 'sp';
          }
          switchSmsGateInAction();
          //switchSmsGateIn();
          setTimeout('switchSmsGateIn()',10);
     }
}

function switchSmsGateOut(){
     if(smsGateSwitcher) {
          if(document.getElementById('smsGateFlashObject').name == 'branaSub'){
               pageType = 'sp';
          }
          switchSmsGateOutAction();
          //switchSmsGateOut();
          setTimeout('switchSmsGateOut()',10);
     }
     else {
          window.document['smsGateFlashObject'].SetVariable('skipIntro', 1);
          window.document['fanzineFlashObject'].SetVariable('skipIntro', 1);
     }
}
