﻿function ValidateMe(){
	obj_article = document.getElementById("submit_article");
	
	if(obj_article.value == ""){
		alert("Please upload the CV then submit.");
		return false;
	}//end if
	
}//end function...

function CheckUpload()
{
	DarkenPage();
    ShowNewsletterPanel();
}
function RemoveAttachemnt(){

	var submit_article = document.getElementById('submit_article');
	submit_article.value="";
	var UPloads = document.getElementById('UPloads');
	UPloads.innerHTML="<img src='images/browse.jpg' width='74' height='20' style='cursor:hand' alt='Click Here to Upload' onclick='CheckUpload()'/>"
}

function ShowNewsletterPanel(){
    var newsletter_panel = document.getElementById('newsletter_panel');
    // w is a width of the newsletter panel
    w = 402;
    // h is a height of the newsletter panel
    h = 187;
  var myWidth = 0, myHeight = 0;

if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }

var wdth_hight = new Array();
wdth_hight = getScrollXY();

// get the x and y coordinates to center the newsletter panel
xc = Math.round((myWidth/2)-(w/2))
yc = Math.round((myHeight/2)-(h/2))

//to fix scrollbars
//window.onscroll=function() { window.scrollTo(wdth_hight[0],wdth_hight[1]) }

//for center aligned .. top and left scroll added..
xc = xc + wdth_hight[0];
yc = yc + wdth_hight[1];

// show the newsletter panel
newsletter_panel.style.left = xc + "px";
newsletter_panel.style.top  = yc + "px";
newsletter_panel.style.display = 'block';

}//end function

function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}//end function

function SignUp()
{
    // hide the newsletter panel
    var newsletter_panel = document.getElementById('newsletter_panel');
    newsletter_panel.style.display = 'none';
    // lighten the page again
    LightenPage();
}
// this function puts the dark screen over the entire page

function DarkenPage()
{
    var page_screen = document.getElementById('page_screen');
	page_screen.style.width = document.body.parentNode.scrollWidth + 'px';
    page_screen.style.height = document.body.parentNode.scrollHeight + 'px';
    page_screen.style.display = 'block';
}

// this function removes the dark screen and the page is light again
function LightenPage()
{
    var page_screen = document.getElementById('page_screen');
    page_screen.style.display = 'none';

}//end function..