// JavaScript Document

//checking int
function chkNumeric(strString)
   //  check for valid numeric strings	
{
   var strValidChars = "0123456789";
   var strChar;
   var blnResult = true;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;  
}

//Connections form validation --> START
function sendOff(c){
   if (document.c.company.value.length <1 || document.c.company.value=="*Company") {
      alert('Please enter Company.')
	  c.company.focus()
      return false;
   } 
   if (document.c.cName.value.length <3 || document.c.cName.value=="*Contact Name") {
      alert('Please enter Full Name.')
	  c.cName.focus()
      return false;
   } 
   if (document.c.phone.value.length <1 || document.c.phone.value=="*Phone Number") {
      alert('Please enter Telephone Number.')
	  c.phone.focus()
      return false;
   } 
    if (document.c.cell.value.length <1 || document.c.cell.value=="*Mobile") {
      alert('Please enter Mobile Number.')
	  c.cell.focus()
      return false;
   } 
   if (document.c.Activity.value.length <1) {
      alert('Please select Activity.')
	  c.Activity.focus()
      return false;
   } 
   if (document.c.website.value.length <1 || document.c.website.value=="*Website") {
      alert('Please enter Website.')
	  c.website.focus()
      return false;
   } 
   if (document.c.Language.value.length <1 || document.c.Language.value=="*Language") {
      alert('Please enter Language.')
	  c.Language.focus()
      return false;
   } 
   if (document.c.country.value =="") {
      alert('Please select country.')
	  c.country.focus()
      return false;
   } 
    validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
	strEmail = document.c.email.value;
	if (strEmail.search(validRegExp) == -1){
	alert("Please enter a valid Email address.");
	c.email.select();
	c.email.focus();
	return false;
	}
   if (document.c.Frequency.value.length <1 || document.c.Frequency.value=="*Frequency") {
      alert('Please enter Frequency.')
	  c.Frequency.focus()
      return false;
   } 
   if (document.c.Distribution.value.length <1 || document.c.Distribution.value=="*Distribution") {
      alert('Please enter Distribution.')
	  c.Distribution.focus()
      return false;
   } 
   return true;
}
//Connections form validation --> END

//newspaper form validation --> START
function sendOff2(c){
   if  (document.c.Mtype.value.length <1) {
      alert('Please select Type.')
	  c.Mtype.focus()
      return false;
   } 
  if (document.c.column.value.length <1) {
      alert('Please select Column.')
	  c.column.focus()
      return false;
   } 
    if (!chkNumeric(document.c.centimeters.value) || document.c.centimeters.value<5 || document.c.centimeters.value>52) {
      alert('Height must be between 5 and 52.')
	  c.centimeters.focus()
      return false;
   } 
   if (document.c.pageprice.value.length <1 || document.c.pageprice.value=="*Specify the page") {
      alert('Please enter Specify the page.')
	  c.pageprice.focus()
      return false;
   } 
   if (document.c.name.value.length <1 || document.c.name.value=="*Your Name:") {
      alert('Please enter Your Name.')
	  c.name.focus()
      return false;
   }
   validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
	strEmail = document.c.email.value;
	if (strEmail.search(validRegExp) == -1){
	alert("Please enter a valid Email.");
	c.email.select();
	c.email.focus();
	return false;
	}
	 if (document.c.country.value.length <1 || document.c.country.value=="*Country:") {
      alert('Please enter your country.')
	  c.country.focus()
      return false;
   }
   if (document.c.phone.value.length <1 || document.c.phone.value=="*Phone:include country/area code") {
      alert('Please enter Phone.')
	  c.phone.focus()
      return false;
   } 
   if (document.c.fax.value.length <1 || document.c.fax.value=="*Fax:include country/area code") {
      alert('Please enter Fax.')
	  c.fax.focus()
      return false;
   } 
   if (document.c.comments.value.length <1) {
      alert('Please select Request type.')
	  c.comments.focus()
      return false;
   } 
  
	
   return true;
}
//newspaper form validation validation --> END

function Calculate(){
	
   if (document.c.page.value.length <1 || document.c.page.value=="*Specify the page") {
      alert('Please  Specify the page.')
	  c.page.focus()
      return false;
   } 
   //Checking if a first page is choosed
	if (document.c.pageType.value=='FP' && document.c.centimeters.value!='' && document.c.Columns.value!=''){
		 alert('You can\'t specify the centimeters and columns for a first page, please choose another page')
	  	 c.page.focus();
     	 return false;
	 }
	if (document.c.pageType.value=='Banner' && document.c.centimeters.value!='' && document.c.Columns.value!=''){
		 alert('You can\'t specify the centimeters and columns for the Banner, please empty them or choose another page')
	  	 c.page.focus();
     	 return false;
	 }
	
	if (document.c.Colors.value.length <1 || document.c.Colors.value=="*Specify the Colors") {
      alert('Please  Specify the selected field.')
	  c.Colors.focus()
      return false;
   } 
	
	var arr = document.c.Colors.value.split("|");
	
	if(arr[0] == 'Full page' || arr[0] == 'Half page' || arr[0] == 'Quarter page'){
		
		   if (document.c.centimeters.value!='' && document.c.Columns.value!=''){
				alert('You can\'t choose Full page, Half page or Quarter page since you specified the centimeters and columns.')
	  	 		c.Colors.focus();
		   	    return false;
		   }
	}
	
	if (document.c.pageType.value!='FP' && arr[0] != 'Full page' && arr[0] != 'Half page' && arr[0] != 'Quarter page' && document.c.pageType.value!='Banner'){
		 if (!chkNumeric(document.c.centimeters.value) || document.c.centimeters.value<5 || document.c.centimeters.value>52) {
		  alert('Height must be between 5 and 52.')
		  c.centimeters.focus()
		  return false;
	   } 
	   if (!document.c.Columns.value) {
		  alert('Column must be less than or equal to 8.')
		  c.Columns.focus()
		  return false;
	   } 
	}
	  
   
   if (!chkNumeric(document.c.copies.value) || document.c.copies.value.length <1) {
      alert('Please specify number of insertion.')
	  c.copies.focus()
      return false;
   }
   //price
   
   
  /*total price*/
   if (document.c.pageType.value=='FP' || document.c.pageType.value=='Banner'){
	  var total = arr[1]
   }
   else {
	   if(arr[0] == 'Full page' || arr[0] == 'Half page' || arr[0] == 'Quarter page'){
		   var total = arr[1];
	   }
	   else{
	   		var total = document.c.centimeters.value * document.c.Columns.value * arr[1]
	   }
   }
	     
   var resulte = eval(total) + eval((document.c.TVA.value*total)/100);
   resulte = resulte * document.c.copies.value;
   document.c.result.value = resulte;
   document.getElementById("totalresult").innerHTML = resulte;
   return resulte ;
}

//calculator form validation --> START
function sendOffcal(c){
	
 if (document.c.page.value.length <1 || document.c.page.value=="*Specify the page") {
      alert('Please  Specify the page.')
	  c.page.focus()
      return false;
   } 
   //Checking if a first page is choosed
	if (document.c.pageType.value=='FP' && document.c.centimeters.value!='' && document.c.Columns.value!=''){
		 alert('You can\'t specify the centimeters and columns for a first page, please choose another page')
	  	 c.page.focus();
     	 return false;
	 }
	if (document.c.pageType.value=='Banner' && document.c.centimeters.value!='' && document.c.Columns.value!=''){
		 alert('You can\'t specify the centimeters and columns for the Banner, please empty them or choose another page')
	  	 c.page.focus();
     	 return false;
	 }
	
	if (document.c.Colors.value.length <1 || document.c.Colors.value=="*Specify the Colors") {
      alert('Please  Specify the selected field.')
	  c.Colors.focus()
      return false;
   } 
	
	var arr = document.c.Colors.value.split("|");
	
	if(arr[0] == 'Full page' || arr[0] == 'Half page' || arr[0] == 'Quarter page'){
		
		   if (document.c.centimeters.value!='' && document.c.Columns.value!=''){
				alert('You can\'t choose Full page, Half page or Quarter page since you specified the centimeters and columns.')
	  	 		c.Colors.focus();
		   	    return false;
		   }
	}
	
	if (document.c.pageType.value!='FP' && arr[0] != 'Full page' && arr[0] != 'Half page' && arr[0] != 'Quarter page' && document.c.pageType.value!='Banner'){
		 if (!chkNumeric(document.c.centimeters.value) || document.c.centimeters.value<5 || document.c.centimeters.value>52) {
		  alert('Height must be between 5 and 52.')
		  c.centimeters.focus()
		  return false;
	   } 
	   if (!document.c.Columns.value) {
		  alert('Column must be less than or equal to 8.')
		  c.Columns.focus()
		  return false;
	   } 
	}
	  
   
   if (!chkNumeric(document.c.copies.value) || document.c.copies.value.length <1) {
      alert('Please specify number of insertion.')
	  c.copies.focus()
      return false;
   }
   
   if (document.c.date.value.length <1) {
      alert('Please specify publishing start date.')
	  c.date.focus()
      return false;
   }
   if (!document.c.Name.value || document.c.Name.value.length <1) {
      alert('Please enter Your Name.')
	  c.Name.focus()
      return false;
   }
   validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
	strEmail = document.c.email.value;
	if (strEmail.search(validRegExp) == -1){
	alert("Please enter a valid Email.");
	//c.email.select();
	c.email.focus();
	return false;
	}
   if (document.c.Phone.value.length <1) {
      alert('Please enter Phone.')
	  c.Phone.focus()
      return false;
   }
   //price
   var arr = document.c.Colors.value.split("|");
   
  /*total price*/
  if (document.c.pageType.value=='FP' || document.c.pageType.value=='Banner')
	  var total = arr[1]
   else {
	   if(arr[0] == 'Full page' || arr[0] == 'Half page' || arr[0] == 'Quarter page'){
		   var total = arr[1];
	   }
	   else{
	   var total = document.c.centimeters.value * document.c.Columns.value * arr[1]
	   }
   }
	   
  var resulte = eval(total) + eval((document.c.TVA.value*total)/100);
  resulte = resulte * document.c.copies.value;
   document.c.result.value = resulte;
   return true;
}
//calculator form validation validation --> END

//Connections inquiry validation --> START
function sendOff3(c){
   if  (document.c.name.value.length <1 || document.c.name.value=="*Full Name:") {
      alert('Please enter your Full Name.')
	  c.name.focus()
      return false;
   } 
  if (document.c.Company.value.length <1 || document.c.Company.value=="*Company:") {
      alert('Please enter Company.')
	  c.Company.focus()
      return false;
   } 
  
	validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
	strEmail = document.c.email.value;
	if (strEmail.search(validRegExp) == -1){
	alert("Please enter a valid Email.");
	c.email.select();
	c.email.focus();
	return false;
	}
	if (document.c.Phone.value.length <1 || document.c.Phone.value=="*Phone Number:") {
      alert('Please enter Phone.')
	  c.Phone.focus()
      return false;
   } 
   return true;
}
//Connections inquiry validation --> END

//for magazine table validity 
function valid()
{
	
   if (document.table.pageprice.value.length <1 || document.table.pageprice.value=="*Specify the page") {
      alert('Please enter Specify the page.')
	  table.pageprice.focus()
      return;
   } 
   if (document.table.name.value.length <1 || document.table.name.value=="*Your Name:") {
      alert('Please enter Your Name.')
	  table.name.focus()
      return;
   }
   validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
	strEmail = document.table.email.value;
	if (strEmail.search(validRegExp) == -1){
	alert("Please enter a valid Email.");
	table.email.select();
	table.email.focus();
	return;
	}
	 if (document.table.country.value.length <1 || document.table.country.value=="*Country:") {
      alert('Please enter your country.')
	  table.country.focus()
      return;
   }
   if (document.table.phone.value.length <1 || document.table.phone.value=="*Phone:include country/area code") {
      alert('Please enter Phone.')
	  table.phone.focus()
      return;
   } 
   if (document.table.fax.value.length <1 || document.table.fax.value=="*Fax:include country/area code") {
      alert('Please enter Fax.')
	  table.fax.focus()
      return;
   } 
   if (document.table.comments.value.length <1) {
      alert('Please select Request type.')
	  table.comments.focus()
      return;
   } 
  
   else
   	document.table.submit();
}
//forcontact us validity 
function valid2()
{
	if (document.table2.name.value =="" || document.table2.name.value == "*Your Name:") {
		alert("Fill the  Name field.");
		document.table2.name.focus();
		return;
	}
		
	if (document.table2.email.value =="" || document.table2.email.value == "*Your E-Mail:") {
		alert("Fill the Email field.");
		document.table2.email.focus();
		return;
	} 
	if ( document.table2.email.value.indexOf ('@', 0) == -1 || document.table2.email.value.indexOf ('.', 0) == -1 ) {
		  alert("Please enter a valid e-mail");
          document.table2.email.focus();
		  return;

        }
  
	if (document.table2.country.value == "" || document.table2.country.value == "*Country:") {
		alert("Fill the country field.");
		document.table2.country.focus();
		return;
	}
	
	if (document.table2.phone.value == "" || document.table2.phone.value == "*Phone:include country/area code") {
		alert("Fill the Tel field.");
		document.table2.phone.focus();
		return;
	}
	if (document.table2.comment.value == "" || document.table2.comment.value == "*Please describe your requirement:") {
		alert("Fill the Comments field.");
		document.table2.comment.focus();
		return;
	}
	else {
		document.table2.submit();
	}
}
function reset1()
{
	document.table2.reset();
}

//Validate Magazine form
function validmagazine()
{
	var k = 0;
	for(i=0; i<document.magazine.elements.length; i++){
		if (document.magazine.elements[i].value == ""){
			k++;
		}
	}
	if(k>1){
		alert ('You must select at least three criteria.');
	}
	else {
		document.magazine.submit();
	}
}


function reset1()
{
	document.table2.reset();
}

function setTxtValue(Txtfield,Txtvalue){
	if (Txtfield.value == "")
		Txtfield.value = Txtvalue;
}

function EmptyTxtValue(Txtfield,Txtvalue){
	if (Txtfield.value == Txtvalue)
		Txtfield.value = "";
}
/*function EmptyTxtValuesi(Txtfield){
		Txtfield.value = "";
}
function setTxtValuesi(Txtfield){
		var currentTime = new Date()
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var year = currentTime.getFullYear()
		Txtfield.value = month + "/" + day + "/" + year;
}*/
//	Activate Flash Function
function activateflashprob()
{
	var strBrowser = navigator.userAgent.toLowerCase();
	
	if(strBrowser.indexOf("msie") > -1 && strBrowser.indexOf("mac") < 0) {
		var theObjects		= document.getElementsByTagName('object');
		var theObjectsLen	= theObjects.length;
		
		for (var i = 0; i < theObjectsLen; i++) {
			if (theObjects[i].outerHTML) {
				if (theObjects[i].data) {
					theObjects[i].removeAttribute('data');
				}
				
				var theParams		= theObjects[i].getElementsByTagName("param");
				var theParamsLength	= theParams.length;
				
				for (var j = 0; j < theParamsLength; j++) {
					if(theParams[j].name.toLowerCase() == 'flashvars') {
						var theFlashVars = theParams[j].value;
					}
 				}
				
				var theOuterHTML	= theObjects[i].outerHTML;
				var re				= /<param name="FlashVars" value="">/ig;
				
				theOuterHTML = theOuterHTML.replace(re,"<param name='FlashVars' value='" + theFlashVars + "'>");
				
				theObjects[i].outerHTML = theOuterHTML;
			}
		}
	}
}

////////////////////flash detection
<!-- New code to check for flash player-->
<!--
// moock fpi [f.lash p.layer i.nspector]
// version: 1.3.7
// written by colin moock
// code maintained at: http://www.moock.org/webdesign/flash/detection/moockfpi/
// terms of use posted at: http://www.moock.org/terms/



// =============================================================================
// These are the user defined globals.
// Modify the following variables to customize the inspection behaviour.

var requiredVersion = 8;   // Version the user needs to view site (max 9, min 2)
var useRedirect = false;    // Flag indicating whether or not to load a separate
                           // page based on detection results. Set to true to
                           // load a separate page. Set to false to embed the
                           // movie or alternate html directly into this page.
    /*                       
// Only set next three vars if useRedirect is true...
var flashPage   = "movie.html"    // The location of the flash movie page
var noFlashPage = "noflash.html"  // Page displayed if the user doesn't have the
                                  // plugin or we can't detect it.
var upgradePage = "upgrade.html"  // Page displayed if we detect an old plugin
// =============================================================================
*/



// *************
// Everything below this point is internal until after the BODY tag.
// Do not modify! Proceed to the BODY tag for further instructions.
// *************

// System globals
var flash2Installed = false;    // boolean. true if flash 2 is installed
var flash3Installed = false;    // boolean. true if flash 3 is installed
var flash4Installed = false;    // boolean. true if flash 4 is installed
var flash5Installed = false;    // boolean. true if flash 5 is installed
var flash6Installed = false;    // boolean. true if flash 6 is installed
var flash7Installed = false;    // boolean. true if flash 7 is installed
var flash8Installed = false;    // boolean. true if flash 8 is installed
var flash9Installed = false;    // boolean. true if flash 9 is installed
var maxVersion = 9;             // highest version we can actually detect
var actualVersion = 0;          // version the user really has
var hasRightVersion = false;    // boolean. true if it's safe to embed the flash movie in the page
var jsVersion = 1.0;            // the version of javascript supported

// -->

//-->


<!--

// Check the browser...we're looking for ie/win
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;    // true if we're on ie
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; // true if we're on windows


// This is a js1.1 code block, so make note that js1.1 is supported.
jsVersion = 1.1;

// Write vbscript detection on ie win. IE on Windows doesn't support regular
// JavaScript plugins array detection.
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('flash8Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))) \n');
  document.write('flash9Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.9"))) \n');
  document.write('<\/SCR' + 'IPT\> \n'); // break up end tag so it doesn't end our script
}
// -->

//-->
<!--

// Next comes the standard javascript detection that uses the 
// navigator.plugins array. We pack the detector into a function so that 
// it preloads before being run.

function detectFlash() {  
  // If navigator.plugins exists...
  if (navigator.plugins) {
    // ...then check for flash 2 or flash 3+.
    if (navigator.plugins["Shockwave Flash 2.0"]
        || navigator.plugins["Shockwave Flash"]) {

      // Some version of Flash was found. Time to figure out which.
      
      // Set convenient references to flash 2 and the plugin description.
      var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
      var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;

      // DEBUGGING: uncomment next line to see the actual description.
      // alert("Flash plugin description: " + flashDescription);
      
      // A flash plugin-description looks like this: Shockwave Flash 4.0 r5
      // We can get the major version by grabbing the character before the period
      // note that we don't bother with minor version detection. 
      // Do that in your movie with $version or getVersion().
      var flashVersion = parseInt(flashDescription.substring(16));

      // We found the version, now set appropriate version flags. Make sure
      // to use >= on the highest version so we don't prevent future version
      // users from entering the site.
      flash2Installed = flashVersion == 2;    
      flash3Installed = flashVersion == 3;
      flash4Installed = flashVersion == 4;
      flash5Installed = flashVersion == 5;
      flash6Installed = flashVersion == 6;
      flash7Installed = flashVersion == 7;
      flash8Installed = flashVersion == 8;
      flash9Installed = flashVersion >= 9;
    }
  }
  
  // Loop through all versions we're checking, and
  // set actualVersion to highest detected version.
  for (var i = 2; i <= maxVersion; i++) {  
    if (eval("flash" + i + "Installed") == true) actualVersion = i;
  }
  
  // If we're on msntv (formerly webtv), the version supported is 4 (as of
  // January 1, 2004). Note that we don't bother sniffing varieties
  // of msntv. You could if you were sadistic...
  if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 4;  
  
  // DEBUGGING: uncomment next line to display flash version
  // alert("version detected: " + actualVersion);


  // We're finished getting the version on all browsers that support detection.
  // Time to take the appropriate action.

  // If the user has a new enough version...
  if (actualVersion >= requiredVersion) {
    // ...then we'll redirect them to the flash page, unless we've
    // been told not to redirect.
  /*  if (useRedirect) {
      // Need javascript1.1 to do location.replace
      if(jsVersion > 1.0) {
        // It's safe to use replace(). Good...we won't break the back button.
        window.location.replace(flashPage);  
      } else {
        // JavaScript version is too old, so use .location to load
        // the flash page.
        window.location = flashPage;
      }
    }*/

    // If we got here, we didn't redirect. So we make a note that we should
    // write out the object/embed tags later.
    hasRightVersion = true;                
  } else {  
    // The user doesn't have a new enough version.
    // If the redirection option is on, load the appropriate alternate page.
    /*if (useRedirect) {
      // Do the same .replace() call only if js1.1+ is available.
      if(jsVersion > 1.0) {
        window.location.replace((actualVersion >= 2) ? upgradePage : noFlashPage);
      } else {
        window.location = (actualVersion >= 2) ? upgradePage : noFlashPage;
      }
    }*/
  }
}
function JustSoPicWindow(imageName,imageWidth,imageHeight,alt,bgcolor,hugger,hugMargin) {
// by E Michael Brandt of ValleyWebDesigns.com - Please leave these comments intact.
// version 3.0.4

        if (bgcolor=="") {
                bgcolor="#FFFFFF";
        }
        var adj=10
        var w = screen.width;
        var h = screen.height;
        var byFactor=1;

        if(w<740){
          var lift=0.90;
        }
        if(w>=740 & w<835){
          var lift=0.91;
        }
        if(w>=835){
          var lift=0.93;
        }
        if (imageWidth>w){
          byFactor = w / imageWidth;
          imageWidth = w;
          imageHeight = imageHeight * byFactor;
        }
        if (imageHeight>h-adj){
          byFactor = h / imageHeight;
          imageWidth = (imageWidth * byFactor);
          imageHeight = h;
        }
        var scrWidth = w-adj;
        var scrHeight = (h*lift)-adj;
        if (imageHeight>scrHeight){
            imageHeight=imageHeight*lift;
          imageWidth=imageWidth*lift;
        }
        var posLeft=0;
        var posTop=0;

        if (hugger == "hug image"){
          if (hugMargin == ""){
            hugMargin = 0;
          }
          var scrHeightTemp = imageHeight - 0 + 2*hugMargin;
          if (scrHeightTemp < scrHeight) {
                scrHeight = scrHeightTemp;
          }
          var scrWidthTemp = imageWidth - 0 + 2*hugMargin;
          if (scrWidthTemp < scrWidth) {
                scrWidth = scrWidthTemp;
          }

          if (scrHeight<100){scrHeight=100;}
          if (scrWidth<100){scrWidth=100;}

          posTop =  ((h-(scrHeight/lift)-adj)/2);
          posLeft = ((w-(scrWidth)-adj)/2);
         }
        if (imageHeight > (h*lift)-adj || imageWidth > w-adj){
                imageHeight=imageHeight-adj;
                imageWidth=imageWidth-adj;
        }
        posTop = parseInt(posTop);
        posLeft = parseInt(posLeft);
        scrWidth = parseInt(scrWidth);
        scrHeight = parseInt(scrHeight);

        var agt=navigator.userAgent.toLowerCase();
        if (agt.indexOf("opera") != -1){
          var args= new Array();
          args[0]='parent';
          args[1]=imageName;
          var i ; document.MM_returnValue = false;
          for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
        } else {
        newWindow = window.open("vwd_justso.htm","newWindow","width="+scrWidth+",height="+scrHeight+",left="+posLeft+",top="+posTop+"");
        newWindow.document.open();
        newWindow.document.write('<html><title>'+alt+'</title><body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor='+bgcolor+'>');
        newWindow.document.write('<table width='+imageWidth+' border="0" cellspacing="0" cellpadding="0" align="center" height='+scrHeight+' ><tr><td>');
        newWindow.document.write('<img src="'+imageName+'" width='+imageWidth+' height='+imageHeight+'>');
        newWindow.document.write('</td></tr></table></body></html>');
        newWindow.document.close();
        newWindow.focus();
        }
}

//For selection disabling
function disableSelection(element) {
    element.onselectstart = function() {
      return false;
    };
    element.unselectable = "on";
    element.style.MozUserSelect = "none";
    element.style.cursor = "default";
	
}

function onLoad() {
  disableSelection(document.getElementById("mainDiv"));

}

<!-- Begin
function right(e) {
if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2))
	return false;
else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) {
alert("Sorry, you do not have permission to right click.");
return false;
}
return true;
}

/*For Ajax*/
var request;
function createRequest() {
  try {
    request = new XMLHttpRequest();
  } catch (trymicrosoft) {
    try {
      request = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (othermicrosoft) {
      try {
        request = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (failed) {
        request = false;
      }
    }
  }
}
function getCustomerInfo() {
	createRequest();
	if (request) {
  		var Id = document.getElementById("relatedBook").value;
		var PriodeID = document.getElementById("PriodeID").value;
		if(Id)
  			var url = "getrelatedbook.php?Id=" + escape(Id) + "&PriodeID=" + escape(PriodeID); 
		else{
			var Idpage = document.getElementById("newspaperID").value;
  			var url = "getrelatedbook.php?Id=" + escape(Idpage) + "&PriodeID=" + escape(PriodeID); 
		}
  		request.open("GET", url, true);
  		request.onreadystatechange = updatePage;
  		request.send(null);

		
	}
	else{
    alert("Error initializing XMLHttpRequest!");
  }
}
function getnewspaperInfo() {
	createRequest();
	if (request) {
		var PriodeID = document.getElementById("PriodeID").value;
		if(!document.getElementById("relatedBook"))
			Idnews = document.getElementById("newspaperID").value;
		else
			var Idnews = document.getElementById("relatedBook").value;
  		var Idpage = document.getElementById("page").value;
		//var Idnews = document.getElementById("relatedBook").value;
  		var url = "getColor.php?Id=" + escape(Idpage)+"&newsID=" + escape(Idnews) + "&PriodeID=" + escape(PriodeID);   
  		request.open("GET", url, true);
  		request.onreadystatechange = updatePage2;
		
  		request.send(null);
	}
	else{
    alert("Error initializing XMLHttpRequest!");
  }
}
function updatePage() {
  if (request.readyState == 4) {
    if (request.status == 200) {
		var response = request.responseText;
		document.getElementById("section").innerHTML = response;
    } else if (request.status == 404) {
      alert ("Requested URL is not found.");
    } else if (request.status == 403) {
      alert("Access denied.");
    } else {
      alert("status is " + request.status);
    }
  }
}
function updatePage2() {
  if (request.readyState == 4) {
    if (request.status == 200) {
		var response = request.responseText;
		document.getElementById("section2").innerHTML = response;
    } else if (request.status == 404) {
      alert ("Requested URL is not found.");
    } else if (request.status == 403) {
      alert("Access denied.");
    } else {
      alert("status is " + request.status);
    }
  }
}
//  End -->
//Png functions
// JavaScript Document
var bgsleight	= function() {
	
	function addLoadEvent(func) {
		var oldonload = window.onload;
		if (typeof window.onload != 'function') {
			window.onload = func;
		} else {
			window.onload = function() {
				if (oldonload) {
					oldonload();
				}
				func();
			}
		}
	}
	
	function fnLoadPngs() {
		var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
		var itsAllGood = (rslt != null && Number(rslt[1]) >= 5.5);
		for (var i = document.all.length - 1, obj = null; (obj = document.all[i]); i--) {
			if (itsAllGood && obj.currentStyle.backgroundImage.match(/\.png/i) != null) {
				fnFixPng(obj);
				obj.attachEvent("onpropertychange", fnPropertyChanged);
			}
		}
	}

	function fnPropertyChanged() {
		if (window.event.propertyName == "style.backgroundImage") {
			var el = window.event.srcElement;
			if (!el.currentStyle.backgroundImage.match(/x\.gif/i)) {
				var bg	= el.currentStyle.backgroundImage;
				var src = bg.substring(5,bg.length-2);
				el.filters.item(0).src = src;
				el.style.backgroundImage = "url(x.gif)";
			}
		}
	}

	function fnFixPng(obj) {
		var bg	= obj.currentStyle.backgroundImage;
		var src = bg.substring(5,bg.length-2);
		obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')";
		obj.style.backgroundImage = "url(x.gif)";
	}
	
	
	
	
	return {
		
		init: function() {
			
			if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent) {
				addLoadEvent(fnLoadPngs);
			}
			
		}
	}
	
}();

bgsleight.init();

/*show logo*/
var MyInterval;
var CurrentNews = 0;
/*var MaxNews = 3;*/
var Myfunction = "Next"

function AutoChange(){
	if(Myfunction=="Next"){
		NextNews()
	}else{
		PreviousNews()
	}
}
function NextNews(MaxNews)
{
	if(document.getElementById('logo'+(CurrentNews+1)))
	{
		for (i=1; i<=MaxNews; i++)	
			document.getElementById('logo'+i).style.display = "none";
			
		document.getElementById('logo'+(CurrentNews+1)).style.display = "";
	}
	
	CurrentNews++;

	if (CurrentNews == MaxNews)
		CurrentNews = 0;
}

function RunDIV(counter)
{
	var MaxNews = counter;
	
	setInterval('NextNews('+MaxNews+')', 3000);
}
//when u select from the selected drop down go to specific url
function gotoUrl(value)

{

            window.location = value;

}