// JavaScript Document
function openNewWindow(URLtoOpen, windowName, windowFeatures) { newWindow=window.open(URLtoOpen, windowName, windowFeatures); }
function copy(inElement) {
  if (inElement.createTextRange) {
    var range = inElement.createTextRange();
    if (range && BodyLoaded==1)
     range.execCommand('Copy');
  } else {
    var flashcopier = 'flashcopier';
    if(!document.getElementById(flashcopier)) {
      var divholder = document.createElement('div');
      divholder.id = flashcopier;
      document.body.appendChild(divholder);
    }
    document.getElementById(flashcopier).innerHTML = '';
    var divinfo = '<embed src="_clipboard.swf" FlashVars="clipboard='+escape(inElement.value)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
    document.getElementById(flashcopier).innerHTML = divinfo;
  }
}

//function dwk_open(URLtoOpen, windowName, windowFeatures) { newWindow=window.open(URLtoOpen, windowName, 'height=740,width=1010,resizable=yes,toolbar=no,scrollbars=no'); }

function l2l_open(URLtoOpen, windowName, windowFeatures) { 
	newWindow=window.open(URLtoOpen, windowName, 'height=428,width=802,resizable=no,toolbar=no,scrollbars=no'); 
}
function getQueryVariable(string,variable) { 
  var query = string;
  var vars = string.split("did="); 

  return vars[1]; 

  alert(vars[1]); 
} 

//use browser sniffing to determine if IE or Opera (ugly, but required)
var isOpera, isIE = false;
if(typeof(window.opera) != 'undefined'){isOpera = true;}
if(!isOpera && navigator.userAgent.indexOf('Internet Explorer')){isIE = true;}

//define for all browsers
function goto(url){
  location.href = url;
}

//re-define for IE
if(isIE){
  function goto(url){
    var referLink = document.createElement('a');
    referLink.href = url;
    document.body.appendChild(referLink);
    referLink.click();
  }
}

function IFrame(parentElement) {

// Create the iframe which will be returned
var iframe = document.createElement("iframe");

if(parentElement == null)
parentElement = document.body;

parentElement.appendChild(iframe);

iframe.doc = null;

if(iframe.contentDocument)

iframe.doc = iframe.contentDocument;
else if(iframe.contentWindow)

iframe.doc = iframe.contentWindow.document;
else if(iframe.document)

iframe.doc = iframe.document;

if(iframe.doc == null)
// Create the script inside the iframe's document which will call the
iframe.doc.open();
iframe.doc.close();
// Return the iframe, now with an extra property iframe.doc containing the
// iframe's document
return iframe;
}

function dwk_open(URLtoOpen, windowName, windowFeatures) {

/*var canvas = document.body;
var iframe = new IFrame(canvas);
var div = iframe.doc.createElement("div");
div.style.width = "50px"; div.style.height = "50px";
div.style.border = "solid 1px #000000";
div.innerHTML = "Hello IFrame!";
iframe.doc.body.appendChild(div);
*/

//use browser sniffing to determine if IE or Opera (ugly, but required)
var isOpera, isIE = false;
if(typeof(window.opera) != 'undefined'){isOpera = true;}
if(navigator.userAgent.indexOf('MSIE')>-1){isIE = true;}

//re-define for IE
if(isIE){
	//alert('ie');
    var referLink = document.createElement('a');
    referLink.href = URLtoOpen;
    referLink.target = "_blank";
    document.body.appendChild(referLink);
    referLink.click();
} else {
	pop = window.open(URLtoOpen, windowName, 'height=740,width=1010,resizable=no,toolbar=no,scrollbars=no');
}
/*
	did = URLtoOpen.split('did=')[1];

	alert('<iframe src="http://www.yclubdealer.com/CVP400/?did='+did+'" frameborder="0" width="100%" height="100%" ');
	pop = window.open(URLtoOpen, windowName, 'height=740,width=1010,resizable=no,toolbar=no,scrollbars=no'); 
pop.document.write('<html><head><title>Online Brochure</title></head>'); 
pop.document.write('<body bgcolor="000000">');
pop.document.write(oldloc); 
pop.document.write('<iframe src="http://www.yclubdealer.com/CVP400/?did='+did+'" frameborder="0" width="100%" height="100%" '); 
pop.document.write('/>'); 
pop.document.write('</body></html>'); 
*/
}



