//---------------------------------------
function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}
//---------------------------------------


//---------------------------------------
var ActiveServicesMenu = false;
var ServicesMenuObj = false;
var ServicesMenuTimer = "";

function DisplayServices(objNam){
  // hide other menus
  var e = document.getElementById("Product_Menu");
  if(e) e.style.visibility = 'hidden';
  e = document.getElementById("Education_Menu");
  if(e) e.style.visibility = 'hidden';

  var obj = document.getElementById(objNam);
   
  var coors = findPos(obj);
  var menu = document.getElementById("Services_Menu");
  menu.style.top = (coors[1] + 21) + "px";
  menu.style.left = (coors[0]-25) + "px";
  menu.style.visibility='visible';
  ActiveServicesMenu = true;
  ServicesMenuObj = "Services_Menu";
}
//---------------------------------------

//---------------------------------------
function ServicesMenuOut(){
  ActiveServicesMenu = false;
  HideServicesTimeout();
}
//---------------------------------------


//---------------------------------------
function HideServicesTimeout(){
  ServicesMenuTimer = setTimeout("HideServices()", 1000);
}
//---------------------------------------


//---------------------------------------
function HideServices(){
  if(ActiveServicesMenu == false){
    var menu = document.getElementById("Services_Menu");
    menu.style.visibility = 'hidden';
    clearTimeout(ServicesMenuTimer);
    ServicesMenuTimer = "";
  }
}
//---------------------------------------

//---------------------------------------
function ServicesMenuItemHover(){
  ActiveServicesMenu = true;
}
//---------------------------------------

//---------------------------------------
var ActiveEdMenu = false;
var EdMenuObj = false;
var EdMenuTimer = "";

function DisplayEd(objNam){
  var e = document.getElementById("Product_Menu");
  if(e) e.style.visibility = 'hidden';
  e = document.getElementById("Services_Menu");
  if(e) e.style.visibility = 'hidden';

  var obj = document.getElementById(objNam);
   
  var coors = findPos(obj);
  var menu = document.getElementById("Education_Menu");
  menu.style.top = (coors[1] + 22) + "px";
  menu.style.left = (coors[0]-360) + "px";
  menu.style.visibility='visible';
  ActiveEdMenu = true;
  EdMenuObj = "Education_Menu";
}
//---------------------------------------


//---------------------------------------
function EdMenuOut(){
  ActiveEdMenu = false;
  HideEdTimeout();
}
//---------------------------------------


//---------------------------------------
function HideEdTimeout(){
  EdMenuTimer = setTimeout("HideEd()", 1000);
}
//---------------------------------------


//---------------------------------------
function HideEd(){
  if(ActiveEdMenu == false){
    var menu = document.getElementById("Education_Menu");
    menu.style.visibility = 'hidden';
    clearTimeout(EdMenuTimer);
    EdMenuTimer = "";
  }
}
//---------------------------------------


//---------------------------------------
function EdMenuItemHover(){
  ActiveEdMenu = true;
}
//---------------------------------------


//---------------------------------------
var ActiveMenu = false;
var MenuObj = false;
var TopMenuTimer = "";

function DisplayProducts(objNam){
  var e = document.getElementById("Education_Menu");
  if(e) e.style.visibility = 'hidden';
  e = document.getElementById("Services_Menu");
  if(e) e.style.visibility = 'hidden';

  var obj = document.getElementById(objNam);
  
  if(obj.style.height) var h = parseInt(obj.style.height);
  else var h = parseInt(obj.offsetHeight);
  
  if(!document.all) h -= 3;
  
  var coors = findPos(obj);
  var menu = document.getElementById("Product_Menu");
  menu.style.top = (coors[1] + h + 9) + "px";
  menu.style.left = (coors[0]-660) + "px";
  menu.style.visibility='visible';
  ActiveMenu = true;
  MenuObj = "Product_Menu";
}
//---------------------------------------

//---------------------------------------
function TopMenuOut(){
  ActiveMenu = false;
  HideTimeout();
}
//---------------------------------------

//---------------------------------------
function HideTimeout(){
  TopMenuTimer = setTimeout("HideProducts()", 1000);
}
//---------------------------------------

//---------------------------------------
function HideProducts(){
  if(ActiveMenu == false){
    var menu = document.getElementById("Product_Menu");
    menu.style.visibility = 'hidden';
    clearTimeout(TopMenuTimer);
    TopMenuTimer = "";
  }
}
//---------------------------------------

//---------------------------------------
function MenuItemHover(){
  ActiveMenu = true;
}
//---------------------------------------


//---------------------------------------
function OpenTut(objnam, id, side){
  var obj = document.getElementById(objnam);
  var coors = findPos(obj);
  if(side) var l = (side * 610);
  else var l = (-1 * 300);
  var tut = document.getElementById("TutWindow");
  if(!tut){
    tut = document.createElement('div');
    tut.setAttribute("id", "TutWindow");
    document.body.appendChild(tut);
    
    var newid = "celldata";
    
    
    var HTML = "<table width='600' cellpadding='0' cellspacing='0' dir='rtl'>";
    HTML += "<tr>";
    HTML += "<td style='height:27px;text-align:left;padding-left:12px;padding-top:5px; background-color:#aaaaab; border: solid 2px #939494; background-image:url(Images/Window_Top_Bar.jpg);'>";
    HTML += "<a href='javascript:void(0);' onclick=\"javascript:document.getElementById('TutWindow').style.visibility='hidden';\"><img src='Images/Icons/RedCloseWin.png' width='28' height='28' alt='סגור חלון' border='0' /></a>";
    HTML + "</td>";
    HTML += "</tr>";
 
    HTML += "<tr>";
    HTML += "<td align='center' valign='top' bgcolor='white' style='height:450px;border: solid 2px #939494; border-top-width:0px; '>";
    HTML += "<div id='celldata' style='scrollbar-base-color:silver;text-align:right;font: normal 12px arial; line-height:20px;width:550px;height:450px;overflow:auto;padding:20px;'>";
    HTML += "</div>";
    HTML += "</td>";
    HTML += "</tr>";
    
    HTML += "</table>";

    tut = document.getElementById("TutWindow");
    tut.style.position = "absolute";
    tut.style.zIndex = 2;
    tut.style.top = (coors[1]-450) + "px";
    tut.style.left = (coors[0]-l) + "px";
    tut.innerHTML = HTML;
    
    var url = "FetchTutorial.php?id=" + id + "&rand=" + Math.random();
    ActiveRequest(url, "celldata");
  }
  else{
    tut.style.top = (coors[1]-450) + "px";
    tut.style.left = (coors[0]-l) + "px";
    tut.style.visibility = 'visible';
    var url = "FetchTutorial.php?id=" + id + "&rand=" + Math.random();
    ActiveRequest(url, "celldata");
  }

  
}
//---------------------------------------


//---------------------------------------
function HideTut(){
  var tut = document.getElementById("TutWindow");
  tut.style.visibility = 'hidden';
}
//---------------------------------------


//---------------------------------------
function BGHover(id, state){
  var obj = document.getElementById(id);
  if(state) obj.className = "BGOn";
  else obj.className = "BGOff";
}
//---------------------------------------

//---------------------------------------
var StyleHideInt = true;
var StyleTimer;
function ShowStyles(objnam, style){
  var obj = document.getElementById(objnam);
  var coors = findPos(obj);
  if(style){
    var list = document.getElementById("IndustryList");
    var hide = document.getElementById("StyleList");
  }
  else{
    var list = document.getElementById("StyleList");
    var hide = document.getElementById("IndustryList");
  }
  hide.style.visibility = "hidden";
  list.style.top = (coors[1] + 31)+ "px";
  list.style.left = (coors[0]+1) + "px";
  list.style.visibility = 'visible';
  
  StyleHideInt = false;
}
//---------------------------------------

//---------------------------------------
function HideStyles(style){
  if(StyleHideInt){
    if(style){
      var list = document.getElementById("IndustryList");
    }
    else{
      var list = document.getElementById("StyleList");
    }
    list.style.visibility = 'hidden';
  }
  clearTimeout(StyleTimer);
}
//---------------------------------------

//---------------------------------------
function HideStyleTimeout(style){
  StyleHideInt = true;
  StyleTimer = setTimeout("HideStyles(" + style + ")", 1000);
}
//---------------------------------------


//---------------------------------------
function SwitchStyles(style, prod, cat, share, orientation){
  //var url = "FetchStyleBGS.php?prod=" + prod + "&style=" + style + "&cat=" + cat + "&share=" + share + "&orientation=" + orientation + "&rand=" + Math.random();
  //VariableRequest(url, UpdateBgList);
  
  var url = "SelectBackground.php?prod=" + prod + "&cat=" + cat + "&style=" + style + "&start=0&share=" + share + "&orientation=" + orientation;
  document.location.href=url;
}
//---------------------------------------


function UpdateBgList(req){
  if (req.readyState == 4 && req.status == 200) {
    var temp = req.responseText;
    var e = document.getElementById("BGArea");
    if(e){
      e.innerHTML = temp;
      DoShaddow();
    }
    else{
      alert("could not find bg area");
      return;
    }
  }
  
}


//---------------------------------------
function SwitchPages(prod, cat, style, page, share){
  //var url = "FetchStyleBGS.php?prod=" + prod + "&style=" + style + "&cat=" + cat + "&page=" + page + "&share=" + share + "&rand=" + Math.random();
  //ActiveRequest(url, "BGArea");
  
  var url = "SelectBackground.php?prod=" + prod + "&cat=" + cat + "&style=" + style + "&start=" + page + "&share=" + share;
  document.location.href=url;
}
//---------------------------------------

//---------------------------------------
function SwitchEdCat(dest){
  document.location.href = dest;
}
//---------------------------------------


//---------------------------------------
function RecommendationInit(){

  var win = document.getElementById("Recommendations");
  if(win){
    win.style.visibility = 'visible';
  }
  else{
    
    win = document.createElement('div');
    win.setAttribute("id", "Recommendations");
    document.body.appendChild(win);
    
    var HTML = "<table width='400' cellpadding='2' cellspacing='0'>";
    
    HTML += "<tr>";
    HTML += "<td colspan='2' align='right' style='background-image:url(Images/Icons/WinTop400.png);background-repeat:no-repeat;background-position: 0px 0px; height:10px;font: normal 4px arial;padding-right:10px;padding-top:8px;'>";
    HTML += "<a href='javascript:void(0);' onclick='javascript:HideRecommendation();'><img src='Images/Icons/GreyXDarker.png' width='22' height='16' alt='סגור חלון' border='0' /></a>";
    HTML += "</td>";
    HTML += "</tr>";
    
    HTML += "<tr>";
    HTML += "<td align='right' colspan='2' bgcolor='white' style='border: solid 5px #C9C9C9; border-top-width:0px; border-bottom-width:0px;padding-right:5px;'>";
    HTML += "<h1 class='PageTitle' style='font-size:16px;margin:2px;'> המלץ/י לחבר על האתר: </h1>";  
    HTML += "</td>";
    HTML += "</tr>";
    
    HTML += "<tr>";
    HTML += "<td align='right' colspan='2' bgcolor='white' style='padding-bottom:5px;padding-left:5px;border: solid 5px #C9C9C9; border-top-width:0px; border-bottom-width:0px;padding-right:5px; font: normal 12px arial; color:#828383;'>";
    HTML += "רוצים להמליץ לחבר על האתר?</br>";
    HTML += "הזינו כמה פרטים וההזמנה תשלח מיד";  
    HTML += "</td>";
    HTML += "</tr>";
    
    HTML += "<tr>";
    HTML += "<td align='right' bgcolor='white' style='border: solid 0px #C9C9C9; border-right-width:5px;padding-right:5px; font: bold 12px arial; color:#636464;'>";
    HTML += "השם שלך:";  
    HTML += "</td>";
    HTML += "<td align='right' bgcolor='white' style='border: solid 0px #C9C9C9; border-left-width:5px;padding-right:5px; font: bold 12px arial; color:#636464;'>";
    HTML += "אימייל:";  
    HTML += "</td>";
    HTML += "</tr>";
    
    HTML += "<tr>";
    HTML += "<td align='right' bgcolor='white' style='border: solid 0px #C9C9C9; border-right-width:5px;padding-right:5px; font: bold 12px arial; color:#636464;'>";
    HTML += "<input type='text' size='23' name='myname' id='myname' style='font: bold 12px arial;' />";  
    HTML += "</td>";
    HTML += "<td align='right' bgcolor='white' style='border: solid 0px #C9C9C9; border-left-width:5px;padding-right:5px; font: bold 12px arial; color:#636464;'>";
    HTML += "<input type='text' size='23' name='myemail' id='myemail' style='font: bold 12px arial;' />";  
    HTML += "</td>";
    HTML += "</tr>";
    
    
    HTML += "<tr>";
    HTML += "<td align='right' bgcolor='white' style='border: solid 0px #C9C9C9; border-right-width:5px;padding-right:5px; font: bold 12px arial; color:#636464;'>";
    HTML += "שם החבר:";  
    HTML += "</td>";
    HTML += "<td align='right' bgcolor='white' style='border: solid 0px #C9C9C9; border-left-width:5px;padding-right:5px; font: bold 12px arial; color:#636464;'>";
    HTML += "כתובת האימייל של החבר:";  
    HTML += "</td>";
    HTML += "</tr>";
    
    
    HTML += "<tr>";
    HTML += "<td align='right' bgcolor='white' style='border: solid 0px #C9C9C9; border-right-width:5px;padding-right:5px; font: bold 12px arial; color:#636464;'>";
    HTML += "<input type='text' size='23' name='friend-name' id='friend-name' style='font: bold 12px arial;' />";  
    HTML += "</td>";
    HTML += "<td align='right' bgcolor='white' style='border: solid 0px #C9C9C9; border-left-width:5px;padding-right:5px; font: bold 12px arial; color:#636464;'>";
    HTML += "<input type='text' size='23' name='friend-email' id='friend-email' style='font: bold 12px arial;' />";  
    HTML += "</td>";
    HTML += "</tr>";
    
    
    HTML += "<tr>";
    HTML += "<td align='center' colspan='2' bgcolor='white' style='border: solid 5px #C9C9C9; border-top-width:0px; border-bottom-width:0px;'>";
    //HTML += "<div style='background-image:url(Images/Icons/Editor/Next.jpg);width:143px; height:26px;padding-top:10px;'>";
    HTML += "<a href='javascript:void(0);' onclick='javascript:SendReferal();' style='font: bold 14px tahoma; color: white; text-decoration:none;'>";
    //HTML += "שלח עכשיו";
    HTML += "<img src='Images/send-button.jpg' width='166' height='41' alt='המלץ לחבר' border='0' />";
    HTML += "</a>";
    //HTML += "</div>";  
    HTML += "</td>";
    HTML += "</tr>";
    
        
    HTML += "<tr>";
    HTML += "<td colspan='2' style='background-image:url(Images/Icons/WinBottom400_rev.png);background-repeat:no-repeat;height:42px;font: normal 4px arial;'>";
    HTML += "&nbsp;</td>";
    HTML += "</tr>";
    
    HTML += "</table>";
    
    var e = document.getElementById("Rec");
    var coors = findPos(e);
    
    
    win = document.getElementById("Recommendations");
    win.innerHTML = HTML;
    
    win.style.visibility = 'visible';
    
    win.style.zIndex = 3;
    win.style.position = 'absolute';
    
    win.style.top = (coors[1]-254) + "px";
    win.style.left = (coors[0]-398) + "px";
    
    FetchUserDetails();
  }
  
}
//---------------------------------------


//---------------------------------------
function FetchUserDetails(){
  var url = "FetchUserDetails.php";
  VariableRequest(url, PlugUserDetails);
}
//---------------------------------------


//---------------------------------------
function PlugUserDetails(req){
  if (req.readyState == 4) {
      var temp = req.responseText;
      if(temp.length<3) return;
      else{
        var arr = temp.split("^^");
        document.getElementById("myname").value = arr[0];
        document.getElementById("myemail").value = arr[1];
      }
  }
}
//---------------------------------------


//---------------------------------------
function HideRecommendation(){
  var win = document.getElementById("Recommendations");
  win.style.visibility = 'hidden';
}
//---------------------------------------

//---------------------------------------
document.onload = LoadAjax();
//---------------------------------------


//---------------------------------------
function LoadAjax(){
  if(typeof VariableRequest!="function"){
    url = "JS/Ajax.js";
    e = document.createElement("script");
    e.src = url;
    e.type="text/javascript";
    document.getElementsByTagName("head")[0].appendChild(e);
  }
  
  if(typeof GoodLength!="function"){
    url = "JS/FormValidation.js";
    e = document.createElement("script");
    e.src = url;
    e.type="text/javascript";
    document.getElementsByTagName("head")[0].appendChild(e);
  }
  
}
//---------------------------------------


//---------------------------------------
function SendReferal(){
  var myname = document.getElementById("myname").value;
  if(myname.length<2){
    alert("אנא מלאו את שימכם");
    document.getElementById("myname").focus();
  }
  
  var myemail = document.getElementById("myemail").value;
  if(myemail.indexOf("@")==-1){
    myemail = "info@inkreadyprint.co.il";
  }
  
  var friend = document.getElementById("friend-name").value;
  if(friend.length<2){
    alert("?מהו שם החבר");
    document.getElementById("friend-name").focus();
  }
  
  var friendEmail = document.getElementById("friend-email").value;
  if(friendEmail.indexOf("@")==-1){
    alert("אנא מלאו כתובת אימייל של החבר");
    document.getElementById("friend-email").focus();
  }
 
  document.getElementById("Recommendations").style.visibility = 'hidden'; 
  var url = "SendReferral.php?myname=" + Url.encode(myname) + "&myemail=" + Url.encode(myemail) + "&friend=" + Url.encode(friend) + "&friendmail=" + Url.encode(friendEmail) + "&rand=" + Math.random();
  VariableRequest(url, ReferalResponse);
}
//---------------------------------------


//---------------------------------------
function ReferalResponse(req){
  if (req.readyState == 4) {
      var temp = req.responseText;
      return;
  }
}
//---------------------------------------


//---------------------------------------
function MainSiteSearch(){
  var field = document.getElementById("SiteSearch");
  if(field.length<2) return;
  else{
    var url = "SiteSearch.php?key=" + Url.encode(field.value) + "&rand=" + Math.random();
    document.location.href = url;
  }
}
//---------------------------------------


//---------------------------------------
function UploadHelp(mode){
  //var win = window.open ("UploadHelp.php","mywindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=450,height=600, top=100, left=200"); 
  if(!mode) var win = window.open ("File_Upload_Guides.php","mywindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=450,height=600, top=100, left=200");
  else var win = window.open ("File_Upload_Guides.php?mode=1","mywindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=450,height=600, top=100, left=200");
}
//---------------------------------------



var IE = document.all?true:false;
if (!IE) document.captureEvents(Event.MOUSEMOVE)
//document.onmousemove = getMouseXY;

var tempX = 0;
var tempY = 0;

//---------------------------------------
function getMouseXY(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft;
    tempY = event.clientY + document.body.scrollTop;
  }
  else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX;
    tempY = e.pageY;
  }  
  if (tempX < 0){tempX = 0;}
  if (tempY < 0){tempY = 0;}  

  var arr = new Array();
  arr[0] = tempX;
  arr[1] = tempY;

  return arr;
}
//---------------------------------------

//---------------------------------------
function AvailSize() {
  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 arr = new Array();
  arr[0] = myWidth;
  arr[1] = myHeight;
  return arr;
}
//---------------------------------------


//---------------------------------------
var ZoomFlag = false;
function ZoomPrev(id, wid, hei, obj){
  ZoomFlag = true;
  var objCoors = findPos(obj);

  var imgWid = (wid*2);
  var winsize = AvailSize();
  
  var src = "FetchItemThumb.php?bg=" + id + "&w=" + imgWid + "&rand=" + Math.random();
  
  var HTML = "<img src='" + src + "' width='" + imgWid + "' border='0' onmouseover='javascript:ZoomFlag = true;' onmouseout='javascript:ZoomFlag=false;' />";
  
  var win = document.getElementById("ZoomP");
  if(!win){
    win = document.createElement('div');
    win.setAttribute("id", "ZoomP");
    document.body.appendChild(win);
    win = document.getElementById("ZoomP");
  }
  

  //var mousePos = getMouseXY();

  win.style.border = 'solid 2px black';
  win.innerHTML = HTML;
  win.style.position = 'absolute';
  
  
  if((imgWid + objCoors[0] + 70) <= winsize[0]){
    win.style.left = (objCoors[0] + 70) + "px";
  }
  else{
    win.style.left = (objCoors[0] + 70 - imgWid) + "px";
  }
  
 
  win.style.top = (objCoors[1] + 70) + "px";
  
  
  win.style.zIndex = 2;
  
  win.style.visibility = 'visible';
  
}
//---------------------------------------

//---------------------------------------
function MoveZoom(e){
  var win = document.getElementById("ZoomP");
  if(win){
    if(win.style.visibility == 'visible'){
      var coors = getMouseXY();
      win.style.top = coors[1] + "px";
      win.style.left = coors[0] + "px";
    }
  }
}
//---------------------------------------


//---------------------------------------
function ZoomHide(){
  if(!ZoomFlag){
    var win = document.getElementById("ZoomP");
    win.style.visibility = 'hidden';
  }
}
//---------------------------------------


//---------------------------------------
function HidePrevZoom(){
  ZoomFlag = false;
  var tm = setTimeout('ZoomHide()', 100);
}
//---------------------------------------


//---------------------------------------
var ObjBorderColor = '#095297'; 
function FieldFocus(obj){
  obj.style.borderColor = 'orange';
}
//---------------------------------------


//---------------------------------------
function FieldBlur(obj){
  obj.style.borderColor = ObjBorderColor;
}
//---------------------------------------


//---------------------------------------
function PlugFlash(){
    var HTML = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' width='692' height='234' id='Movie1' align='middle'>";
    HTML += "<param name='allowScriptAccess' value='sameDomain' />";
    HTML += "<param name='wmode' value='transparent' />";
    HTML += "<param name='movie' value='Images/main_banner.swf' />";
    HTML += "<param name='quality' value='high' />";
    HTML += "<param name='bgcolor' value='#ffffff' />";
    HTML += "<param name='LOOP' value='1' />";
    HTML += "<param name='swliveconnect' value='true' />";
    HTML += "<embed src='Images/main_banner.swf' quality='high' bgcolor='#ffffff' width='692' height='234' name='Movie1' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' wmode='transparent' />";
    HTML += "</object>";
    
    document.getElementById("MainBanner").innerHTML = HTML;
}
//---------------------------------------


//---------------------------------------
var lrgImgs = new Array();
function PreloadImages(){  
  for(i=1;i!=limgs.length;i++){
    lrgImgs[i] = new Image();
    lrgImgs[i].src = limgs[i];
    lrgImgs[i].onLoad = SetLargeImage(i);
  }
}
//---------------------------------------


//---------------------------------------
function SetLargeImage(t){
  var nam, img;
  nam = "LargeImg" + t;
  img = document.getElementById(nam);
  img.src = lrgImgs[t].src;
  return;
}
//---------------------------------------


//---------------------------------------
function UploadHelpNav(type){
  if(type){
    var e = document.getElementById("help1");
    e.className = 'Help_Menu_On';
    
    e = document.getElementById("help2");
    e.className = 'Help_Menu_Off';
    
    ActiveRequest("UploadHelp.php", "Help_Body");
  }
  else{
    var e = document.getElementById("help2");
    e.className = 'Help_Menu_On';
    
    e = document.getElementById("help1");
    e.className = 'Help_Menu_Off';
    
    ActiveRequest("File_Closing_Guide.php", "Help_Body");
  }
}
//---------------------------------------


//---------------------------------------
function ReplaceDesignBut(state){
  var e= document.getElementById('DesignOnline');
  if(state){
     e.src = DesignOn.src; 
  }
  else{
    e.src = DesignOff.src;
  }
}
//---------------------------------------


//---------------------------------------
function ReplaceUploadBut(state){
  var e= document.getElementById('UploadDesign');
  if(state){
     e.src = UploadOn.src; 
  }
  else{
    e.src = UploadOff.src;
  }
}
//---------------------------------------


//---------------------------------------
function ReplaceWeDesignBut(state){
  var e= document.getElementById('WeDesign');
  if(state){
     e.src = WeDesignOn.src; 
  }
  else{
    e.src = WeDesignOff.src;
  }
}
//---------------------------------------


//---------------------------------------
function SwitchDesignService(state){
  var e = document.getElementById("DesignServicesLink");
  if(state) e.src = 'Images/design-dervises-on.png';
  else e.src = 'Images/design-dervises-off.png';
}
//---------------------------------------

//---------------------------------------
function DesignButSwitch(id, url){
   var e= document.getElementById(id);
   e.src = "Images/DesignStudioButtons/" + url;
}
//---------------------------------------



//---------------------------------------
function RestartSpecTDS(){
  var obj = document.getElementById('tdprice');
  obj.className = "SpecsOff";
  obj = document.getElementById('tddim');
  obj.className = "SpecsOff"; 
  obj = document.getElementById('tdformat');
  obj.className = "SpecsOff";
}
//---------------------------------------


//---------------------------------------
function switch_specs_prices(objnam, prod){
  RestartSpecTDS();
  var obj = document.getElementById(objnam);
  obj.className = "SpecsOn";
  var url='product_data_ajax.php?prod=' + prod + '&rand=' + Math.random();
  ActiveRequest(url, "dataTD");
}
//---------------------------------------


//---------------------------------------
function switch_specs_dimensions(objnam, prod){
  RestartSpecTDS();
  var obj = document.getElementById(objnam);
  obj.className = "SpecsOn";
  var url='product_specs_ajax.php?prod=' + prod + '&rand=' + Math.random();
  ActiveRequest(url, "dataTD");
}
//---------------------------------------


//---------------------------------------
function switch_specs_format(objnam, prod){
  RestartSpecTDS();
  var obj = document.getElementById(objnam);
  obj.className = "SpecsOn";
  var url = 'Acceptable_File_Formats.php?rand=' + Math.random();
  ActiveRequest(url, "dataTD");
}
//---------------------------------------
